skalibs

Mirror/fork of https://skarnet.org/software/skalibs/
git clone https://ccx.te2000.cz/git/skalibs
Log | Files | Refs | README | LICENSE

timespec_cmp.c (302B)


      1 /* ISC license. */
      2 
      3 #include <time.h>
      4 
      5 #include <skalibs/djbtime.h>
      6 
      7 int timespec_cmp (struct timespec const *a, struct timespec const *b)
      8 {
      9   if (a->tv_sec < b->tv_sec) return -1 ;
     10   if (a->tv_sec > b->tv_sec) return 1 ;
     11   if (a->tv_nsec < b->tv_nsec) return -1 ;
     12   return a->tv_nsec > b->tv_nsec ;
     13 }