tain_to_millisecs.c (300B)
1 /* ISC license. */ 2 3 #include <skalibs/uint64.h> 4 #include <skalibs/tai.h> 5 6 int tain_to_millisecs (tain const *a) 7 { 8 if (a->sec.x > (uint64_t)2147483) return -1 ; 9 if ((a->sec.x == (uint64_t)2147483) && (a->nano > 646000000U)) return -1 ; 10 return a->sec.x * 1000 + (a->nano + 999999) / 1000000U ; 11 }