utc_from_tai.c (289B)
1 /* ISC license. */ 2 3 #include <errno.h> 4 #include <skalibs/djbtime.h> 5 #include "djbtime-internal.h" 6 7 int utc_from_tai (uint64_t *u, tai const *t) 8 { 9 int r = 1 ; 10 uint64_t tt = t->x - 10 ; 11 if (t->x < 10U) return (errno = EINVAL, 0) ; 12 r += leapsecs_sub(&tt) ; 13 *u = tt ; 14 return r ; 15 }