skalibs

Mirror/fork of https://skarnet.org/software/skalibs/
git clone https://ccx.te2000.cz/git/skalibs
Log | Files | Refs | README | LICENSE

tain_sub.c (286B)


      1 /* ISC license. */
      2 
      3 #include <skalibs/tai.h>
      4 
      5 int tain_sub (tain *t, tain const *u, tain const *v)
      6 {
      7   tain tt ;
      8   tt.sec.x = u->sec.x - v->sec.x ;
      9   tt.nano = u->nano - v->nano ;
     10   if (tt.nano > u->nano)
     11   {
     12     tt.sec.x-- ;
     13     tt.nano += 1000000000U ;
     14   }
     15   *t = tt ;
     16   return 1 ;
     17 }