Switch to unified view

a/src/utils/smallut.cpp b/src/utils/smallut.cpp
...
...
664
  long   tv_nsec;
664
  long   tv_nsec;
665
};
665
};
666
#endif
666
#endif
667
667
668
#ifndef CLOCK_REALTIME
668
#ifndef CLOCK_REALTIME
669
typedef int clockid_t;
669
#define CLOCK_REALTIME 1
670
#define CLOCK_REALTIME 1
670
#endif
671
#endif
671
672
672
#define MILLIS(TV) ( (long)(((TV).tv_sec - m_secs) * 1000L + \
673
#define MILLIS(TV) ( (long)(((TV).tv_sec - m_secs) * 1000L + \
673
  ((TV).tv_nsec - m_nsecs) / 1000000))
674
  ((TV).tv_nsec - m_nsecs) / 1000000))
674
#define MICROS(TV) ( (long)(((TV).tv_sec - m_secs) * 1000000L + \
675
#define MICROS(TV) ( (long)(((TV).tv_sec - m_secs) * 1000000L + \
675
  ((TV).tv_nsec - m_nsecs) / 1000))
676
  ((TV).tv_nsec - m_nsecs) / 1000))
676
#define NANOS(TV) ( (long long)(((TV).tv_sec - m_secs) * 1000000000LL + \
677
#define NANOS(TV) ( (long long)(((TV).tv_sec - m_secs) * 1000000000LL + \
677
  ((TV).tv_nsec - m_nsecs)))
678
  ((TV).tv_nsec - m_nsecs)))
678
679
#ifdef __APPLE__
680
#include <sys/time.h>
681
#endif
679
static void gettime(clockid_t clk_id, struct timespec *ts)
682
static void gettime(clockid_t clk_id, struct timespec *ts)
680
{
683
{
684
#ifdef __APPLE__
685
    struct timeval tv;
686
    gettimeofday(&tv, 0);
687
    ts->tv_sec = tv.tv_sec;
688
    ts->tv_nsec = tv.tv_usec * 1000;
689
#else
681
    clock_gettime(clk_id, ts);
690
    clock_gettime(clk_id, ts);
691
#endif
682
}
692
}
683
///// End system interface
693
///// End system interface
684
694
685
// Note: this not protected against multithread access and not reentrant, but
695
// Note: this not protected against multithread access and not reentrant, but
686
// this is mostly debug code, and it won't crash, just show bad results. Also 
696
// this is mostly debug code, and it won't crash, just show bad results. Also