skalibs

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

leapsecs_add.c (319B)


      1 /* ISC license. */
      2 
      3 #include <skalibs/uint64.h>
      4 #include "djbtime-internal.h"
      5 
      6 void leapsecs_add (uint64_t *t, int hit)
      7 {
      8   uint64_t u = *t - !!hit ;
      9   unsigned int i = 0 ;
     10   for (; i < leapsecs_table_len ; i++)
     11   {
     12     if (u < leapsecs_table[i]) break ;
     13     if (!hit || (leapsecs_table[i] < u)) ++u ;
     14   }
     15   *t = u ;
     16 }