Diff for /qemu/qemu-timer.h between versions 1.1.1.3 and 1.1.1.4

version 1.1.1.3, 2018/04/24 18:24:48 version 1.1.1.4, 2018/04/24 18:34:34
Line 2 Line 2
 #define QEMU_TIMER_H  #define QEMU_TIMER_H
   
 #include "qemu-common.h"  #include "qemu-common.h"
   #include <time.h>
   #include <sys/time.h>
   
   #ifdef _WIN32
   #include <windows.h>
   #include <mmsystem.h>
   #endif
   
 /* timers */  /* timers */
   
Line 52  static inline int64_t get_ticks_per_sec( Line 59  static inline int64_t get_ticks_per_sec(
     return 1000000000LL;      return 1000000000LL;
 }  }
   
   /* real time host monotonic timer */
   static inline int64_t get_clock_realtime(void)
   {
       struct timeval tv;
   
       gettimeofday(&tv, NULL);
       return tv.tv_sec * 1000000000LL + (tv.tv_usec * 1000);
   }
   
   /* Warning: don't insert tracepoints into these functions, they are
      also used by simpletrace backend and tracepoints would cause
      an infinite recursion! */
   #ifdef _WIN32
   extern int64_t clock_freq;
   
   static inline int64_t get_clock(void)
   {
       LARGE_INTEGER ti;
       QueryPerformanceCounter(&ti);
       return muldiv64(ti.QuadPart, get_ticks_per_sec(), clock_freq);
   }
   
   #else
   
   extern int use_rt_clock;
   
   static inline int64_t get_clock(void)
   {
   #if defined(__linux__) || (defined(__FreeBSD__) && __FreeBSD_version >= 500000) \
       || defined(__DragonFly__) || defined(__FreeBSD_kernel__)
       if (use_rt_clock) {
           struct timespec ts;
           clock_gettime(CLOCK_MONOTONIC, &ts);
           return ts.tv_sec * 1000000000LL + ts.tv_nsec;
       } else
   #endif
       {
           /* XXX: using gettimeofday leads to problems if the date
              changes, so it should be avoided. */
           return get_clock_realtime();
       }
   }
   #endif
   
 void qemu_get_timer(QEMUFile *f, QEMUTimer *ts);  void qemu_get_timer(QEMUFile *f, QEMUTimer *ts);
 void qemu_put_timer(QEMUFile *f, QEMUTimer *ts);  void qemu_put_timer(QEMUFile *f, QEMUTimer *ts);

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


unix.superglobalmegacorp.com