summaryrefslogtreecommitdiff
path: root/src/libstddjb/leapsecs_add.c
blob: 74736930e87632241b7874e2045f3a93f4b6ecc9 (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 *t, int hit)
{
  uint64_t u = *t ;
  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 ;
}