ICU-3677 uprv_getUTCtime should return UDate instead of int32_t.
This is for cases where time_t is 64-bit. X-SVN-Rev: 16150
This commit is contained in:
parent
0cc1b6a9ed
commit
608ca77ba5
@ -214,7 +214,7 @@ u_bottomNBytesOfDouble(double* d, int n)
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
/* Get UTC (GMT) time measured in seconds since 0:00 on 1/1/70.*/
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
U_CAPI UDate U_EXPORT2
|
||||
uprv_getUTCtime()
|
||||
{
|
||||
#ifdef XP_MAC
|
||||
@ -230,11 +230,11 @@ uprv_getUTCtime()
|
||||
time(&t);
|
||||
uprv_memcpy( &tmrec, gmtime(&t), sizeof(tmrec) );
|
||||
t2 = mktime(&tmrec); /* seconds of current GMT*/
|
||||
return t2 - t1; /* GMT (or UTC) in seconds since 1970*/
|
||||
return (UDate)(t2 - t1) * U_MILLIS_PER_SECOND; /* GMT (or UTC) in seconds since 1970*/
|
||||
#else
|
||||
time_t epochtime;
|
||||
time(&epochtime);
|
||||
return epochtime;
|
||||
return (UDate)epochtime * U_MILLIS_PER_SECOND;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -238,11 +238,11 @@ U_STABLE int32_t U_EXPORT2 uprv_timezone(void);
|
||||
U_INTERNAL const char* U_EXPORT2 uprv_tzname(int n);
|
||||
|
||||
/**
|
||||
* Get UTC (GMT) time measured in seconds since 0:00 on 1/1/70.
|
||||
* @return the UTC time measured in seconds
|
||||
* Get UTC (GMT) time measured in milliseconds since 0:00 on 1/1/1970.
|
||||
* @return the UTC time measured in milliseconds
|
||||
* @internal
|
||||
*/
|
||||
U_INTERNAL int32_t U_EXPORT2 uprv_getUTCtime(void);
|
||||
U_INTERNAL UDate U_EXPORT2 uprv_getUTCtime(void);
|
||||
|
||||
/**
|
||||
* Return the ICU data directory.
|
||||
|
@ -783,7 +783,7 @@ Calendar::getAvailableLocales(int32_t& count)
|
||||
UDate
|
||||
Calendar::getNow()
|
||||
{
|
||||
return (UDate)uprv_getUTCtime() * U_MILLIS_PER_SECOND; // return as milliseconds
|
||||
return uprv_getUTCtime(); // return as milliseconds
|
||||
}
|
||||
|
||||
// -------------------------------------
|
||||
|
@ -446,7 +446,7 @@ UBool OlsonTimeZone::useDaylightTime() const {
|
||||
// DST is in use in the current year (at any point in the year)
|
||||
// and returns TRUE if so.
|
||||
|
||||
int32_t days = Math::floorDivide(uprv_getUTCtime(), SECONDS_PER_DAY); // epoch days
|
||||
int32_t days = (int32_t)Math::floorDivide(uprv_getUTCtime(), (double)U_MILLIS_PER_DAY); // epoch days
|
||||
|
||||
int32_t year, month, dom, dow;
|
||||
|
||||
|
@ -245,7 +245,7 @@ static void TestPUtilAPI(void){
|
||||
if ((tzoffset % 1800 != 0)) {
|
||||
log_err("FAIL: t_timezone may be incorrect. It is not a multiple of 30min.");
|
||||
}
|
||||
tzoffset=uprv_getUTCtime();
|
||||
/*tzoffset=uprv_getUTCtime();*/
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -36,10 +36,10 @@
|
||||
if (exec) { \
|
||||
logln(#test "---"); \
|
||||
logln((UnicodeString)""); \
|
||||
int32_t t = uprv_getUTCtime(); \
|
||||
UDate t = uprv_getUTCtime(); \
|
||||
test(); \
|
||||
t = uprv_getUTCtime() - t; \
|
||||
logln((UnicodeString)#test " took " + t + " seconds"); \
|
||||
logln((UnicodeString)#test " took " + t/U_MILLIS_PER_DAY + " seconds"); \
|
||||
} \
|
||||
break
|
||||
|
||||
|
@ -643,7 +643,7 @@ public:
|
||||
public:
|
||||
TestMutexThread1 & fOtherThread;
|
||||
UBool fDone, fErr;
|
||||
int32_t fElapsed;
|
||||
UDate fElapsed;
|
||||
private:
|
||||
/**
|
||||
* The assignment operator has no real implementation.
|
||||
@ -687,7 +687,7 @@ void MultithreadTest::TestMutex()
|
||||
{
|
||||
if(thread2.fErr)
|
||||
errln("Thread 2 says: thread1 didn't run before I aquired the mutex.");
|
||||
logln("took %lu seconds for thread2 to aquire the mutex.", thread2.fElapsed);
|
||||
logln("took %lu seconds for thread2 to aquire the mutex.", (int)(thread2.fElapsed/U_MILLIS_PER_DAY));
|
||||
return;
|
||||
}
|
||||
SimpleThread::sleep(1000);
|
||||
|
Loading…
Reference in New Issue
Block a user