~brianaker/libmemcached/1164440

« back to all changes in this revision

Viewing changes to libtest/timer.hpp

  • Committer: Continuous Integration
  • Date: 2012-10-22 05:56:09 UTC
  • mfrom: (1086.1.8 libmemcached-1.0)
  • Revision ID: ci@tangent.org-20121022055609-cbooaw9bcdal4qge
Merge lp:~tangent-org/libmemcached/1.0-build Build: jenkins-Libmemcached-1.0-87

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
#  include <mach/clock.h>
45
45
#  include <mach/mach.h>
46
46
#else
47
 
#  include <time.h>
48
47
#  include <sys/time.h>
49
48
#endif
50
49
 
123
122
    mach_port_deallocate(mach_task_self(), _clock_serv);
124
123
    ts.tv_sec= _mach_timespec.tv_sec;
125
124
    ts.tv_nsec= _mach_timespec.tv_nsec;
126
 
#elif defined(HAVE_CLOCK_GETTIME) && HAVE_CLOCK_GETTIME
127
 
    int ret;
128
 
    do
129
 
    {
130
 
      ret= clock_gettime(CLOCK_REALTIME, &ts);
131
 
    } while (ret == -1);
132
 
#elif defined(HAVE_GETTIMEOFDAY) && HAVE_GETTIMEOFDAY
133
 
    struct timeval tv;
134
 
    int ret;
135
 
    do 
136
 
    {
137
 
      ret= gettimeofday(&tv, NULL)
138
 
    } while (ret == -1);
139
 
    /* Convert from timeval to timespec */
140
 
    ts.tv_sec= tv.tv_sec;
141
 
    ts.tv_nsec= tv.tv_usec * 1000;
142
125
#else
143
 
    memset(&ts, 0, sizeof(struct timespec));
 
126
    clock_gettime(CLOCK_REALTIME, &ts);
144
127
#endif
145
128
  }
146
129