21
21
ibool ut_always_false = FALSE;
24
/*********************************************************************
25
NOTE: The Windows epoch starts from 1601/01/01 whereas the Unix
26
epoch starts from 1970/1/1. For selection of constant see:
27
http://support.microsoft.com/kb/167296/ */
28
#define WIN_TO_UNIX_DELTA_USEC ((ib_longlong) 11644473600000000ULL)
31
/*********************************************************************
32
This is the Windows version of gettimeofday(2).*/
37
/* out: 0 if all OK else -1 */
38
struct timeval* tv, /* out: Values are relative to Unix epoch */
39
void* tz) /* in: not used */
49
GetSystemTimeAsFileTime(&ft);
51
tm = (ib_longlong) ft.dwHighDateTime << 32;
52
tm |= ft.dwLowDateTime;
54
ut_a(tm >= 0); /* If tm wraps over to negative, the quotient / 10
57
tm /= 10; /* Convert from 100 nsec periods to usec */
59
/* If we don't convert to the Unix epoch the value for
60
struct timeval::tv_sec will overflow.*/
61
tm -= WIN_TO_UNIX_DELTA_USEC;
63
tv->tv_sec = (long) (tm / 1000000L);
64
tv->tv_usec = (long) (tm % 1000000L);
69
#define ut_gettimeofday gettimeofday
23
72
#ifndef UNIV_HOTBACKUP
24
73
/*********************************************************************
25
74
Display an SQL identifier.
85
134
ulint* sec, /* out: seconds since the Epoch */
86
135
ulint* ms) /* out: microseconds since the Epoch+*sec */
91
*sec = (ulint) st.wSecond;
92
*ms = (ulint) st.wMilliseconds;
94
137
struct timeval tv;
95
gettimeofday(&tv,NULL);
139
ut_gettimeofday(&tv, NULL);
96
140
*sec = (ulint) tv.tv_sec;
97
141
*ms = (ulint) tv.tv_usec;
101
144
/**************************************************************