~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/my_getsystime.c

MergeĀ fromĀ trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
#include "mysys_priv.h"
26
26
#include "my_static.h"
27
27
 
28
 
ulonglong my_getsystime()
 
28
uint64_t my_getsystime()
29
29
{
30
30
#ifdef HAVE_CLOCK_GETTIME
31
31
  struct timespec tp;
32
32
  clock_gettime(CLOCK_REALTIME, &tp);
33
 
  return (ulonglong)tp.tv_sec*10000000+(ulonglong)tp.tv_nsec/100;
 
33
  return (uint64_t)tp.tv_sec*10000000+(uint64_t)tp.tv_nsec/100;
34
34
#else
35
35
  /* TODO: check for other possibilities for hi-res timestamping */
36
36
  struct timeval tv;
37
37
  gettimeofday(&tv,NULL);
38
 
  return (ulonglong)tv.tv_sec*10000000+(ulonglong)tv.tv_usec*10;
 
38
  return (uint64_t)tv.tv_sec*10000000+(uint64_t)tv.tv_usec*10;
39
39
#endif
40
40
}
41
41
 
88
88
    Value in microseconds from some undefined point in time
89
89
*/
90
90
 
91
 
ulonglong my_micro_time()
 
91
uint64_t my_micro_time()
92
92
{
93
93
#if defined(HAVE_GETHRTIME)
94
94
  return gethrtime()/1000;
95
95
#else
96
 
  ulonglong newtime;
 
96
  uint64_t newtime;
97
97
  struct timeval t;
98
98
  /*
99
99
    The following loop is here because gettimeofday may fail on some systems
100
100
  */
101
101
  while (gettimeofday(&t, NULL) != 0)
102
102
  {}
103
 
  newtime= (ulonglong)t.tv_sec * 1000000 + t.tv_usec;
 
103
  newtime= (uint64_t)t.tv_sec * 1000000 + t.tv_usec;
104
104
  return newtime;
105
105
#endif  /* defined(HAVE_GETHRTIME) */
106
106
}
130
130
 
131
131
#define DELTA_FOR_SECONDS 500000000LL  /* Half a second */
132
132
 
133
 
ulonglong my_micro_time_and_time(time_t *time_arg)
 
133
uint64_t my_micro_time_and_time(time_t *time_arg)
134
134
{
135
135
#if defined(HAVE_GETHRTIME)
136
136
  /*
152
152
  pthread_mutex_unlock(&THR_LOCK_time);
153
153
  return cur_gethrtime/1000;
154
154
#else
155
 
  ulonglong newtime;
 
155
  uint64_t newtime;
156
156
  struct timeval t;
157
157
  /*
158
158
    The following loop is here because gettimeofday may fail on some systems
160
160
  while (gettimeofday(&t, NULL) != 0)
161
161
  {}
162
162
  *time_arg= t.tv_sec;
163
 
  newtime= (ulonglong)t.tv_sec * 1000000 + t.tv_usec;
 
163
  newtime= (uint64_t)t.tv_sec * 1000000 + t.tv_usec;
164
164
  return newtime;
165
165
#endif  /* defined(HAVE_GETHRTIME) */
166
166
}
182
182
    current time
183
183
*/
184
184
 
185
 
time_t my_time_possible_from_micro(ulonglong microtime __attribute__((unused)))
 
185
time_t my_time_possible_from_micro(uint64_t microtime __attribute__((unused)))
186
186
{
187
187
#if defined(HAVE_GETHRTIME)
188
188
  return my_time(0);                            /* Cached time */