[LEAPSECS] DNS examples

Steffen Nurpmeso sdaoden at yandex.com
Thu Jan 22 09:47:12 EST 2015


Rob Seaman <seaman at noao.edu> wrote:
 |I think it’s clear that DNS won’t support all leap second \
 |use cases, but that it may provide a high reliability / low \
 |latency method for some specific purposes.  Here is PHK’s specific example:
 |
 | $ dig +short leap.net-tid.dk a | ./leapdecode.py
 | 248.40.141.250 -> OK  2015  7  +35 +1
 |
 |(dig might be useful for some script, but most usage will \
 |be more direct methods, of course)  Leapdecode.py is PHK’s \
 |crc8() and dec() functions with:

 |The next.leapsec.com <http://next.leapsec.com/> address could \
 |be coupled with prev.leapsec.com <http://prev.leapsec.com/> \
 |and other options.  Etc and so forth.

Cool!
Below a simple C version for the interested.  It doesn't iterate
over the results but only uses the first; it also doesn't provide
an encode mode.  Compile with either of (dependend on wether you
want gethostbyname(3) or getaddrinfo(3), written with the former):

  $0[]$ cc -o leapsec phk-utcdrift.c
  $0[]$ cc -DWANT_GETHOSTBYNAME -o leapsec phk-utcdrift.c

  ?0[]$ ./leapsec 248.40.141.250
  248.40.141.250 -> OK 2015-07 +35 +1
  ?0[]$ ./leapsec next.leapsec.com
  248.40.141.250 -> OK 2015-07 +35 +1
  ?0[]$ ./leapsec leap.net-tid.dk
  248.40.141.250 -> OK 2015-07 +35 +1
  ?0[]$ ./leapsec prev.leapsec.com
  247.152.137.102 -> OK 2012-07 +34 +1
  ?0[]$ ./leapsec google.com
  ! CRC checksum failure
  216.58.211.14 -> BAD 0000-00 +0 +0
  ?65[]$

Errors go to standard error, exit status uses BSD sysexits.h
constants.

--steffen
-------------- next part --------------
A non-text attachment was scrubbed...
Name: phk-utcdrift.c
Type: text/x-csrc
Size: 5388 bytes
Desc: not available
URL: <https://pairlist6.pair.net/pipermail/leapsecs/attachments/20150122/3b2e6a43/attachment.c>


More information about the LEAPSECS mailing list