summaryrefslogtreecommitdiff
path: root/src/libstddjb/tain_addsec.c
blob: c5804448b00374b8018c60d5f61de42ad462686e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/* ISC license. */

#include <skalibs/uint64.h>
#include <skalibs/tai.h>

int tain_addsec (tain *b, tain const *a, int c)
{
  if (c >= 0)
  {
    tai t = { .x = (uint64_t)c } ;
    tai_add(&b->sec, &a->sec, &t) ;
  }
  else
  {
    tai t = { .x = (uint64_t)-c } ;
    tai_sub(&b->sec, &a->sec, &t) ;
  }
  b->nano = a->nano ;
  return 1 ;
}