summaryrefslogtreecommitdiff
path: root/src/KM_util.cpp
diff options
context:
space:
mode:
authormsheby <msheby@cinecert.com>2009-08-26 18:19:14 +0000
committermsheby <>2009-08-26 18:19:14 +0000
commit26e2051ac4ec9341662833d6b96016856d95c0f4 (patch)
tree38defeda2870b7344daae59ec3fec216a822094d /src/KM_util.cpp
parentdb7fa5c0ca1143b100edd42e06dec560a9c0e26e (diff)
Implement Windows version of Timestamp::GetSecondsSinceEpoch.
Diffstat (limited to 'src/KM_util.cpp')
-rwxr-xr-xsrc/KM_util.cpp27
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
}
//------------------------------------------------------------------------------------------