about summary refs log tree commit diff
path: root/tools/make-leapsecs_table
blob: fe23feb5a841b7662eb4cfbce9fb0ba86807602c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/command/execlineb -P

# Compile convert-leapsecs.c, then use this to create
# src/libstddjb/leapsecs_table.c

define PREFIX ./tools

backtick -n N
{
  pipeline
  {
    redirfd -r 0 ${PREFIX}/leapsecs.txt
    ${PREFIX}/convert-leapsecs
  }
  wc -l
}
import -u N

if
{
  s6-echo "/* ISC license. */

/* This file has been generated by ./tools/make-leapsecs_table */

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

unsigned int const leapsecs_table_len = ${N} ;
static uint64_t const leapsecs_table_[${N}] =\n{"
}

if
{
  redirfd -r 0 ${PREFIX}/leapsecs.txt
  ${PREFIX}/convert-leapsecs
}

s6-echo "} ;\nuint64_t const *const leapsecs_table = leapsecs_table_ ;"