* Fix Alpine 3.13 ARM build
Alpine 3.13 is the first version of Alpine Linux that uses 64 bit time_t
on both 64 and 32 bit platforms. That breaks the build as we assumed
that 32 bit platforms use always 32 bit time_t.
This change fixes it by making the PAL time_t type always 64 bit.
Everything still works fine on non-Alpine ARM / x86 Linuxes, since
it only changes the time_t type size outside of PAL.
* Fix case when time function gets NULL argument
#ifndef PAL_STDCPP_COMPAT
-#if HOST_64BIT || _MSC_VER >= 1400
typedef __int64 time_t;
-#else
-typedef long time_t;
-#endif
#define _TIME_T_DEFINED
#endif // !PAL_STDCPP_COMPAT
PERF_ENTRY(time);
ENTRY( "time( tloc=%p )\n",tloc );
- result = time(tloc);
+ time_t t;
+ result = time(&t);
+ if (tloc != NULL)
+ {
+ *tloc = t;
+ }
LOGEXIT( "time returning %#lx\n",result );
PERF_EXIT(time);
if (!sInitializedMRand)
{
- srand48(time(NULL));
+ srand48((long int)time(NULL));
sInitializedMRand = true;
}