diff options
Diffstat (limited to 'src/libstddjb/tain_addsec.c')
-rw-r--r-- | src/libstddjb/tain_addsec.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/libstddjb/tain_addsec.c b/src/libstddjb/tain_addsec.c index f4252a7..524ac20 100644 --- a/src/libstddjb/tain_addsec.c +++ b/src/libstddjb/tain_addsec.c @@ -2,19 +2,20 @@ #include <skalibs/tai.h> -void tain_addsec (tain_t *b, tain_t const *a, int c) +int tain_addsec (tain_t *b, tain_t const *a, int c) { - b->nano = a->nano ; if (c >= 0) { tai_t t ; - tai_u64(&t, c) ; - tai_add(&b->sec, &a->sec, &t) ; + if (!tai_u64(&t, c)) return 0 ; + if (!tai_add(&b->sec, &a->sec, &t)) return 0 ; } else { tai_t t ; - tai_u64(&t, -c) ; - tai_sub(&b->sec, &a->sec, &t) ; + if (!tai_u64(&t, -c)) return 0 ; + if (!tai_sub(&b->sec, &a->sec, &t)) return 0 ; } + b->nano = a->nano ; + return 1 ; } |