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

#include <skalibs/tai.h>

int tain_sub (tain_t *t, tain_t const *u, tain_t const *v)
{
  tain_t tt ;
  tt.sec.x = u->sec.x - v->sec.x ;
  tt.nano = u->nano - v->nano ;
  if (tt.nano > u->nano)
  {
    tt.sec.x-- ;
    tt.nano += 1000000000U ;
  }
  *t = tt ;
  return 1 ;
}