From f04d64869f3b1de54fb343f28f955584780001b8 Mon Sep 17 00:00:00 2001 From: mataes2007 Date: Sat, 26 Nov 2011 15:41:10 +0000 Subject: Project folders rename part 3 git-svn-id: http://miranda-plugins.googlecode.com/svn/trunk@215 e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb --- SecureIM/gettime.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 SecureIM/gettime.cpp (limited to 'SecureIM/gettime.cpp') 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 -- cgit v1.2.3