tain_addsec.c (341B)
1 /* ISC license. */ 2 3 #include <skalibs/uint64.h> 4 #include <skalibs/tai.h> 5 6 int tain_addsec (tain *b, tain const *a, int c) 7 { 8 if (c >= 0) 9 { 10 tai t = { .x = (uint64_t)c } ; 11 tai_add(&b->sec, &a->sec, &t) ; 12 } 13 else 14 { 15 tai t = { .x = (uint64_t)-c } ; 16 tai_sub(&b->sec, &a->sec, &t) ; 17 } 18 b->nano = a->nano ; 19 return 1 ; 20 }