diff options
author | mataes2007 <mataes2007@e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb> | 2011-11-26 15:41:10 +0000 |
---|---|---|
committer | mataes2007 <mataes2007@e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb> | 2011-11-26 15:41:10 +0000 |
commit | f04d64869f3b1de54fb343f28f955584780001b8 (patch) | |
tree | 5453dc10de3d980de79ffe019fa0b5fcb692a27d /SecureIM/gettime.cpp | |
parent | 7aff1e4cb053394db57c2814d5fe1e6493e0cc75 (diff) |
Project folders rename part 3
git-svn-id: http://miranda-plugins.googlecode.com/svn/trunk@215 e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb
Diffstat (limited to 'SecureIM/gettime.cpp')
-rw-r--r-- | SecureIM/gettime.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/SecureIM/gettime.cpp b/SecureIM/gettime.cpp new file mode 100644 index 0000000..529a8e0 --- /dev/null +++ b/SecureIM/gettime.cpp @@ -0,0 +1,29 @@ +#include "commonheaders.h"
+
+
+/* FILETIME unit is 100 nanoseconds */
+const static long div_100_nsec = 10000000;
+
+/* POSIX or Unix Epoch (1-Jan-1970 00:00) in FILETIME units */
+#ifdef _MSC_VER
+const static ULONGLONG ix_epoch = 116444736000000000;
+#else
+const static ULONGLONG ix_epoch = 116444736000000000LL;
+#endif
+
+DWORD gettime(void) {
+
+ ULONGLONG diff_100_nsec;
+ union {
+ FILETIME f;
+ ULARGE_INTEGER u;
+ } now;
+
+ GetSystemTimeAsFileTime( &now.f );
+
+ diff_100_nsec = now.u.QuadPart - ix_epoch;
+
+ return (DWORD)( diff_100_nsec / div_100_nsec );
+}
+
+// EOF
|