wwvbpy: WWVB timecode generator in python

A few weeks ago, I posted about a WWVB timecode generator written in C. Unfortunately, this timecode generator did not have a clear license permitting modification or redistribution, so I felt I was unable to incorporate it into a project of my own.

Thus was born my own timecode generator, called wwvbpy. Its primary output mode is compatible with the "wwvb2.c" that inspired it. It also has a few features that wwvb2.c didn't: automatic handling of DST, DUT1, and leap seconds. DST is handled according to the operating system's rules for Denver. DUT1 and leap seconds are handled using data from IERS (As a result, my program's DUT1 does not exactly match past broadcast data on WWVB, as the data NIST broadcasts is "an average value for an extended range of dates").

It also has a set of tests of interesting times, such as the first and second days after a DST change, the last and last-but-one days of leap and non-leap years, a historical leap second, etc. (where possible, these test vectors were originally generated by wwvb2; however, some of the tests—such as the DST tests—had to be hand-generated, as wwvb2 couldn't generate them; besides this limitation, I also uncovered a bug in wwvb2 where non-leap years were treated as having 364 days and leap-years were treated as having 365!)

An option to output the timecode data to a serial device is contemplated but not finished; ultimately, this would work together with an Arduino/AVR firmware to produce a logic-level and/or 60kHz modulated version of the signal for testing hardware devices.

wwvbpy is covered by the GNU GPL v2+. It can be obtained from https://github.com/jepler/wwvbpy.

Entry first conceived on 25 July 2011, 13:41 UTC