mirror of
https://github.com/pocoproject/poco.git
synced 2025-11-25 06:36:37 +01:00
merge poco-1.7.9 into poco-1.8.0
This commit is contained in:
@@ -38,6 +38,15 @@
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef POCO_HAVE_CLOCK_GETTIME
|
||||
#if (defined(_POSIX_TIMERS) && defined(CLOCK_REALTIME)) || defined(POCO_VXWORKS) || defined(__QNX__)
|
||||
#ifndef __APPLE__ // See GitHub issue #1453 - not available before Mac OS 10.12/iOS 10
|
||||
#define POCO_HAVE_CLOCK_GETTIME
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(_WIN32_WCE) && defined(POCO_WINCE_TIMESTAMP_HACK)
|
||||
|
||||
|
||||
@@ -107,18 +116,18 @@ public:
|
||||
void systemTime(SYSTEMTIME* pST)
|
||||
{
|
||||
std::memset(pST, 0, sizeof(SYSTEMTIME));
|
||||
|
||||
|
||||
WORD tick = GetTickCount() % 1000;
|
||||
GetSystemTime(pST);
|
||||
WORD ms = (tick >= _offset) ? (tick - _offset) : (1000 - (_offset - tick));
|
||||
pST->wMilliseconds = ms;
|
||||
pST->wMilliseconds = ms;
|
||||
}
|
||||
|
||||
void systemTimeAsFileTime(FILETIME* pFT)
|
||||
{
|
||||
SYSTEMTIME st;
|
||||
systemTime(&st);
|
||||
SystemTimeToFileTime(&st, pFT);
|
||||
SystemTimeToFileTime(&st, pFT);
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -131,7 +140,7 @@ static TickOffset offset;
|
||||
|
||||
void GetSystemTimeAsFileTimeWithMillisecondResolution(FILETIME* pFT)
|
||||
{
|
||||
offset.systemTimeAsFileTime(pFT);
|
||||
offset.systemTimeAsFileTime(pFT);
|
||||
}
|
||||
|
||||
|
||||
@@ -226,7 +235,7 @@ void Timestamp::update()
|
||||
ts.QuadPart -= epoch.QuadPart;
|
||||
_ts = ts.QuadPart/10;
|
||||
|
||||
#elif (defined(_POSIX_TIMERS) && defined(CLOCK_REALTIME)) || defined(POCO_VXWORKS) || defined(__QNX__)
|
||||
#elif defined(POCO_HAVE_CLOCK_GETTIME)
|
||||
|
||||
struct timespec ts;
|
||||
if (clock_gettime(CLOCK_REALTIME, &ts))
|
||||
@@ -239,7 +248,7 @@ void Timestamp::update()
|
||||
if (gettimeofday(&tv, NULL))
|
||||
throw SystemException("cannot get time of day");
|
||||
_ts = TimeVal(tv.tv_sec)*resolution() + tv.tv_usec;
|
||||
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -276,7 +285,7 @@ Timestamp Timestamp::fromFileTimeNP(UInt32 fileTimeLow, UInt32 fileTimeHigh)
|
||||
ULARGE_INTEGER epoch; // UNIX epoch (1970-01-01 00:00:00) expressed in Windows NT FILETIME
|
||||
epoch.LowPart = 0xD53E8000;
|
||||
epoch.HighPart = 0x019DB1DE;
|
||||
|
||||
|
||||
ULARGE_INTEGER ts;
|
||||
ts.LowPart = fileTimeLow;
|
||||
ts.HighPart = fileTimeHigh;
|
||||
|
||||
Reference in New Issue
Block a user