summaryrefslogtreecommitdiff
path: root/src/libstddjb/tain_addsec.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2015-01-09 01:00:59 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2015-01-09 01:00:59 +0000
commit1c032ec5855551c44b88f94fc35fa87db4279f0a (patch)
tree4aabf428c1346f01dbb65d726450d18add172603 /src/libstddjb/tain_addsec.c
parentc2b04f3c900553ce385203b54e351df0e79449e1 (diff)
downloadskalibs-1c032ec5855551c44b88f94fc35fa87db4279f0a.tar.xz
tai conversion functions overhaul.
API change -> rc for 2.2.0.0 Doc updated.
Diffstat (limited to 'src/libstddjb/tain_addsec.c')
-rw-r--r--src/libstddjb/tain_addsec.c13
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 ;
}