ltm64_from_localtm.c (312B)
1 /* ISC license. */ 2 3 #include <errno.h> 4 #include <time.h> 5 #include <skalibs/tai.h> 6 #include <skalibs/djbtime.h> 7 8 int ltm64_from_localtm (uint64_t *uu, struct tm const *l) 9 { 10 struct tm ll = *l ; 11 time_t u = mktime(&ll) ; 12 if (u == (time_t)-1) return (errno = EINVAL, 0) ; 13 *uu = TAI_MAGIC + u ; 14 return 1 ; 15 }