Diff for /embedaddon/bmon/src/utils.c between versions 1.1.1.2 and 1.1.1.3

version 1.1.1.2, 2014/07/30 07:55:27 version 1.1.1.3, 2019/10/21 14:58:35
Line 27 Line 27
 #include <bmon/conf.h>  #include <bmon/conf.h>
 #include <bmon/utils.h>  #include <bmon/utils.h>
   
   #ifdef __MACH__
   #include <mach/clock.h>
   #include <mach/mach.h>
   #endif
   
 void *xcalloc(size_t n, size_t s)  void *xcalloc(size_t n, size_t s)
 {  {
         void *d = calloc(n, s);          void *d = calloc(n, s);
Line 112  int timestamp_is_negative(timestamp_t *ts) Line 117  int timestamp_is_negative(timestamp_t *ts)
   
 void update_timestamp(timestamp_t *dst)  void update_timestamp(timestamp_t *dst)
 {  {
        struct timeval tv;#ifdef __MACH__
         clock_serv_t cclock;
         mach_timespec_t tp;
   
        gettimeofday(&tv, NULL);        host_get_clock_service(mach_host_self(), SYSTEM_CLOCK, &cclock);
         clock_get_time(cclock, &tp);
         mach_port_deallocate(mach_task_self(), cclock);
 #else
         struct timespec tp;
   
        dst->tv_sec = tv.tv_sec;        clock_gettime(CLOCK_MONOTONIC, &tp);
        dst->tv_usec = tv.tv_usec;#endif
 
         dst->tv_sec = tp.tv_sec;
         dst->tv_usec = tp.tv_nsec / 1000;
 }  }
   
 void copy_timestamp(timestamp_t *ts1, timestamp_t *ts2)  void copy_timestamp(timestamp_t *ts1, timestamp_t *ts2)
 {  {
         ts1->tv_sec = ts2->tv_sec;          ts1->tv_sec = ts2->tv_sec;
        ts2->tv_usec = ts2->tv_usec;        ts1->tv_usec = ts2->tv_usec;
 }  }
   
 float timestamp_diff(timestamp_t *t1, timestamp_t *t2)  float timestamp_diff(timestamp_t *t1, timestamp_t *t2)

Removed from v.1.1.1.2  
changed lines
  Added in v.1.1.1.3


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>