diff options
Diffstat (limited to 'src/libstddjb/tain_add.c')
-rw-r--r-- | src/libstddjb/tain_add.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/libstddjb/tain_add.c b/src/libstddjb/tain_add.c new file mode 100644 index 0000000..6c6a237 --- /dev/null +++ b/src/libstddjb/tain_add.c @@ -0,0 +1,14 @@ +/* ISC license. */ + +#include <skalibs/tai.h> + +void tain_add (tain_t *t, tain_t const *u, tain_t const *v) +{ + tai_add(&t->sec, &u->sec, &v->sec) ; + t->nano = u->nano + v->nano ; + if (t->nano > 999999999U) + { + t->nano -= 1000000000U ; + tai_u64(&t->sec, tai_sec(&t->sec)+1) ; + } +} |