40 lines
2.7 KiB
HTML
40 lines
2.7 KiB
HTML
---
|
|
layout: post
|
|
title: "wwvbpy: WWVB timecode generator in python"
|
|
redirect_from:
|
|
- /01311601289
|
|
---
|
|
<div style="float:right;clear:right"><!-- timecode.png--><div class=albumouter style=width:306px id=><div class=albumimage style="width:306px;margin-left:0px;"><a href="https://media.unpythonic.net/emergent-files/01311601289/timecode.png" class="thickbox" rel="album" title="Timecode for the 1998 leap second"><img src="https://media.unpythonic.net/emergent-files/01311601289/timecode-small.jpg" width=300 height=72></a><div ><div style="float: right" ><a href="https://media.unpythonic.net/emergent-files/01311601289/timecode.png"><img class=zoom src="https://media.unpythonic.net/emergent-files/default/zoom.png"></a></div><a href="https://media.unpythonic.net/emergent-files/01311601289/timecode.png">Timecode for the 1998 leap second</a></div></div></div>
|
|
</div>
|
|
A few weeks ago, I posted about a <a href="https://gamma.unpythonic.net/01308865139">WWVB timecode
|
|
generator written in C</a>. 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.
|
|
|
|
<p>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").
|
|
|
|
<p>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!)
|
|
|
|
<p>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.
|
|
|
|
<p>wwvbpy is covered by the GNU GPL v2+. It can be obtained from <a href="https://github.com/jepler/wwvbpy">https://github.com/jepler/wwvbpy</a>.
|
|
<br><br><font size=-2>Entry first conceived on 25 July 2011, 13:41 UTC</font>
|
|
</body>
|
|
</html>
|