diff options
| author | msheby <msheby@cinecert.com> | 2009-08-26 18:19:14 +0000 |
|---|---|---|
| committer | msheby <> | 2009-08-26 18:19:14 +0000 |
| commit | 26e2051ac4ec9341662833d6b96016856d95c0f4 (patch) | |
| tree | 38defeda2870b7344daae59ec3fec216a822094d /src/KM_util.cpp | |
| parent | db7fa5c0ca1143b100edd42e06dec560a9c0e26e (diff) | |
Implement Windows version of Timestamp::GetSecondsSinceEpoch.
Diffstat (limited to 'src/KM_util.cpp')
| -rwxr-xr-x | src/KM_util.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/KM_util.cpp b/src/KM_util.cpp index 08ae257..7fcd6e3 100755 --- a/src/KM_util.cpp +++ b/src/KM_util.cpp @@ -1129,12 +1129,39 @@ Kumu::Timestamp::Archive(MemIOWriter* Writer) const long Kumu::Timestamp::GetSecondsSinceEpoch(void) const { +#ifdef KM_WIN32 + SYSTEMTIME timeST; + TIMESTAMP_TO_SYSTIME(*this, &timeST); + FILETIME timeFT; + SystemTimeToFileTime(&timeST, &timeFT); + ULARGE_INTEGER timeUL; + timeUL.LowPart = timeFT.dwLowDateTime; + timeUL.HighPart = timeFT.dwHighDateTime; + + SYSTEMTIME epochST; + epochST.wYear = 1970; + epochST.wMonth = 0; + epochST.wDayOfWeek = 4; + epochST.wDay = 1; + epochST.wHour = 0; + epochST.wMinute = 0; + epochST.wSecond = 0; + epochST.wMilliseconds = 0; + FILETIME epochFT; + SystemTimeToFileTime(&epochST, &epochFT); + ULARGE_INTEGER epochUL; + epochUL.LowPart = epochFT.dwLowDateTime; + epochUL.HighPart = epochFT.dwHighDateTime; + + return (timeUL.QuadPart - epochUL.QuadPart) / 10000000; +#else Kumu::TAI::caltime ct; Kumu::TAI::tai t; TIMESTAMP_TO_CALTIME(*this, &ct); t = ct; return (long) (t.x - ui64_C(4611686018427387914)); +#endif } //------------------------------------------------------------------------------------------ |
