summaryrefslogtreecommitdiff
path: root/src/libstddjb/tain_sub.c
blob: f7dd4eb5ffb3e185d612c9334c3582ae8d9f1ddd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/* ISC license. */

#include <skalibs/tai.h>

void tain_sub (tain_t *t, tain_t const *u, tain_t const *v)
{
  tain_t uu = *u ;
  tai_sub(&t->sec, &uu.sec, &v->sec) ;
  t->nano = uu.nano - v->nano ;
  if (t->nano > uu.nano)
  {
    t->nano += 1000000000U ;
    tai_u64(&t->sec, tai_sec(&t->sec)-1) ;
  }
}