summaryrefslogtreecommitdiff
path: root/tools/make-leapsecs_table
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2015-10-14 22:54:08 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2015-10-14 22:54:08 +0000
commit805729e206b7586c57483aa0f4a90f7e0e2c9661 (patch)
tree4d4afb75b73cd11c953853faa48dc4cc7f236380 /tools/make-leapsecs_table
parent2e0421fc58922697f2bb51c428599fbd44055556 (diff)
downloadskalibs-805729e206b7586c57483aa0f4a90f7e0e2c9661.tar.xz
- Remove /etc/leapsecs.datv2.3.8.0
- Publish tools to create the leap second table as a .c - Simplify functions using leap seconds - rc for 2.3.8.0
Diffstat (limited to 'tools/make-leapsecs_table')
-rwxr-xr-xtools/make-leapsecs_table39
1 files changed, 39 insertions, 0 deletions
diff --git a/tools/make-leapsecs_table b/tools/make-leapsecs_table
new file mode 100755
index 0000000..c62fdde
--- /dev/null
+++ b/tools/make-leapsecs_table
@@ -0,0 +1,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. */
+
+/* MT-unsafe */
+
+#include <skalibs/uint64.h>
+#include <skalibs/tai.h>
+#include \"djbtime-internal.h\"
+
+unsigned int const leapsecs_table_len = ${N} ;
+static uint64 const leapsecs_table_[${N}] =\n{"
+}
+
+if
+{
+ redirfd -r 0 ${PREFIX}/leapsecs.txt
+ ${PREFIX}/convert-leapsecs
+}
+
+s6-echo "} ;\nuint64 const *const leapsecs_table = leapsecs_table_ ;"