25 #include "mysys_priv.h"
26 #include "my_static.h"
40 ulonglong my_getsystime()
42 #ifdef HAVE_CLOCK_GETTIME
44 clock_gettime(CLOCK_REALTIME, &tp);
45 return (ulonglong)tp.tv_sec*10000000+(ulonglong)tp.tv_nsec/100;
48 if (query_performance_frequency)
50 QueryPerformanceCounter(&t_cnt);
51 return ((t_cnt.QuadPart / query_performance_frequency * 10000000) +
52 ((t_cnt.QuadPart % query_performance_frequency) * 10000000 /
53 query_performance_frequency) + query_performance_offset);
59 gettimeofday(&tv,NULL);
60 return (ulonglong)tv.tv_sec*10000000+(ulonglong)tv.tv_usec*10;
73 time_t my_time(myf
flags)
77 while ((t= time(0)) == (time_t) -1)
80 fprintf(stderr,
"%s: Warning: time() call failed\n", my_progname);
86 #define OFFSET_TO_EPOCH 116444736000000000ULL
99 ulonglong my_micro_time()
103 GetSystemTimeAsFileTime((FILETIME*)&newtime);
104 newtime-= OFFSET_TO_EPOCH;
112 while (gettimeofday(&t, NULL) != 0)
114 newtime= (ulonglong)t.tv_sec * 1000000 + t.tv_usec;
139 ulonglong my_micro_time_and_time(time_t *time_arg)
143 GetSystemTimeAsFileTime((FILETIME*)&newtime);
144 *time_arg= (time_t) ((newtime - OFFSET_TO_EPOCH) / 10000000);
152 while (gettimeofday(&t, NULL) != 0)
155 newtime= (ulonglong)t.tv_sec * 1000000 + t.tv_usec;
173 time_t my_time_possible_from_micro(ulonglong microtime __attribute__((unused)))
177 while ((t= time(0)) == (time_t) -1)
181 return (time_t) (microtime / 1000000);