diff options
Diffstat (limited to 'mysys/my_init.c')
-rw-r--r-- | mysys/my_init.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/mysys/my_init.c b/mysys/my_init.c index c1337205eb4..8281d7ced99 100644 --- a/mysys/my_init.c +++ b/mysys/my_init.c @@ -371,6 +371,28 @@ static void my_win_init(void) /* chiude la chiave */ RegCloseKey(hSoftMysql) ; + + /* The following is used by time functions */ +#define OFFSET_TO_EPOC ((__int64) 134774 * 24 * 60 * 60 * 1000 * 1000 * 10) +#define MS 10000000 + { + FILETIME ft; + LARGE_INTEGER li, t_cnt; + DBUG_ASSERT(sizeof(LARGE_INTEGER) == sizeof(query_performance_frequency)); + if (QueryPerformanceFrequency((LARGE_INTEGER *)&query_performance_frequency)) + query_performance_frequency= 0; + else + { + GetSystemTimeAsFileTime(&ft); + li.LowPart= ft.dwLowDateTime; + li.HighPart= ft.dwHighDateTime; + query_performance_offset= li.QuadPart-OFFSET_TO_EPOC; + QueryPerformanceCounter(&t_cnt); + query_performance_offset-= (t_cnt.QuadPart / query_performance_frequency * MS + + t_cnt.QuadPart % query_performance_frequency * MS / + query_performance_frequency); + } + } DBUG_VOID_RETURN ; } |