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

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

int leapsecs_sub (uint64 *t)
{
  uint64 u = *t ;
  uint64 d = 0 ;
  register unsigned int i = 0 ;
  register int hit = 0 ;
  for (; i < leapsecs_table_len ; i++)
  {
    if (u < leapsecs_table[i]) break ;
    ++d ;
    if (u == leapsecs_table[i]) hit = 1 ;
  }
  *t = u - d ;
  return hit ;
}