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

#include <skalibs/uint64.h>
#include "djbtime-internal.h"

void leapsecs_add (uint64 *t, int hit)
{
  uint64 u = *t ;
  register unsigned int i = 0 ;
  for (; i < leapsecs_table_len ; i++)
  {
    if (u < leapsecs_table[i]) break ;
    if (!hit || (leapsecs_table[i] < u)) ++u ;
  }
  *t = u ;
}