runit

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

tai.h (630B)


      1 /* Public domain. */
      2 
      3 #ifndef TAI_H
      4 #define TAI_H
      5 
      6 #include <stdint.h>
      7 
      8 struct tai {
      9   uint64_t x;
     10 } ;
     11 
     12 #define tai_unix(t,u) ((void) ((t)->x = 4611686018427387914ULL + (uint64_t) (u)))
     13 
     14 extern void tai_now(struct tai *);
     15 
     16 #define tai_approx(t) ((double) ((t)->x))
     17 
     18 extern void tai_add(struct tai *,const struct tai *,const struct tai *);
     19 extern void tai_sub(struct tai *,const struct tai *,const struct tai *);
     20 #define tai_less(t,u) ((t)->x < (u)->x)
     21 
     22 #define TAI_PACK 8
     23 extern void tai_pack(char *,const struct tai *);
     24 extern void tai_unpack(const char *,struct tai *);
     25 
     26 extern void tai_uint(struct tai *,unsigned int);
     27 
     28 #endif