199 lines
No EOL
6.3 KiB
HTML
199 lines
No EOL
6.3 KiB
HTML
---
|
|
layout: default
|
|
title: "wwvbpy: WWVB timecode generator in python"
|
|
redirect_from:
|
|
- /01311601289
|
|
---
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
<html>
|
|
<head>
|
|
<title>wwvbpy: WWVB timecode generator in python</title>
|
|
<link rel="stylesheet" href="https://media.unpythonic.net/css/bootstrap.min.css">
|
|
<style>
|
|
|
|
|
|
#mask {
|
|
position: absolute;
|
|
left: 0;
|
|
top: 0;
|
|
background-color: #000;
|
|
opacity: 0.7;
|
|
display: none;
|
|
}
|
|
|
|
#loading {
|
|
position: fixed;
|
|
left: 50%;
|
|
top: 50%;
|
|
width: 58px;
|
|
height: 60px;
|
|
background-color: black;
|
|
background-image: url('https://media.unpythonic.net/img/loading.gif');
|
|
opacity: 0.9;
|
|
z-index: 20;
|
|
display: none;
|
|
border-radius: 4px;
|
|
}
|
|
|
|
#bigimg {
|
|
position: fixed;
|
|
top: 0;
|
|
left: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
display: none;
|
|
}
|
|
|
|
#maskouter {
|
|
height: 100%;
|
|
display: table;
|
|
margin: 0 auto;
|
|
}
|
|
|
|
#maskinner {
|
|
vertical-align: middle;
|
|
display: table-cell;
|
|
}
|
|
|
|
#imgleft, #imgright {
|
|
cursor: pointer;
|
|
position: fixed;
|
|
top: 50%;
|
|
width: 64px;
|
|
height: 64px;
|
|
border-radius: 4px;
|
|
background-color: black;
|
|
z-index: 22;
|
|
opacity: 0.7;
|
|
}
|
|
|
|
#imgleft {
|
|
left: 0;
|
|
background-image: url('https://media.unpythonic.net/img/prevbtn.png');
|
|
}
|
|
|
|
#imgleft.disabled, #imgright.disabled { display: none; }
|
|
|
|
#imgright {
|
|
right: 0;
|
|
background-image: url('https://media.unpythonic.net/img/nextbtn.png');
|
|
}
|
|
|
|
#imgdesc {
|
|
position: fixed;
|
|
left: 64px;
|
|
bottom: 0;
|
|
background-color: #333;
|
|
width: 100%;
|
|
padding-top: 1em;
|
|
padding-bottom: 1em;
|
|
padding-left: 2em;
|
|
border: 1px solid #555;
|
|
border-bottom: 0;
|
|
}
|
|
|
|
#imgdesc .filename {
|
|
color: #fff;
|
|
font-weight: bold;
|
|
}
|
|
|
|
#imgdesc .description {
|
|
color: #fff;
|
|
padding-left: 1em;
|
|
}
|
|
|
|
#mask { z-index: 10990; }
|
|
#loading { z-index: 10991; }
|
|
#bigimg { z-index: 10992; }
|
|
|
|
</style>
|
|
<script type="text/javascript" src="https://media.unpythonic.net/js/jquery-1.6.4.min.js"></script>
|
|
<script type="text/javascript" src="https://media.unpythonic.net/js/bootstrap-dropdown.js"></script>
|
|
<script type="text/javascript" src="https://media.unpythonic.net/js/jquery.mousewheel.js"></script>
|
|
<script type="text/javascript" src="https://media.unpythonic.net/js/jquery.ba-hashchange.min.js"></script>
|
|
<script type="text/javascript" src="https://media.unpythonic.net/js/jquery.mobile.custom.min.js"></script>
|
|
<script type="text/javascript" src="https://media.unpythonic.net/js/gallery.js"></script>
|
|
<style><!--
|
|
div.floatimageleft, div.floatimageright {
|
|
border: 1px solid black;
|
|
padding: 2px;
|
|
margin: 1em;
|
|
}
|
|
div.floatimageleft { clear: left; float: left; }
|
|
div.floatimageright { clear: right; float: right; }
|
|
div.floatimageleft img, div.floatimageright img { border: 0px; }
|
|
|
|
div.floatimageleft img.zoom, div.floatimageright img.zoom {
|
|
padding: 4px;
|
|
}
|
|
--></style>
|
|
<style><!--
|
|
div.albumouter {
|
|
margin-right: 1ex;
|
|
margin-top: 1ex;
|
|
vertical-align: baseline;
|
|
display: -moz-inline-box;
|
|
display: inline-block;
|
|
text-decoration: none !important;
|
|
}
|
|
|
|
.album { display: block; clear: both; }
|
|
|
|
.album a:link, .album a:hover, .album a:visited
|
|
{ text-decoration: none; }
|
|
.album a:hover { color: red; }
|
|
|
|
.albumimage {
|
|
display: block;
|
|
padding-left: 2px; padding-right: 2px;
|
|
padding-top: 3px; padding-bottom: 3px;
|
|
background: #ececec;
|
|
}
|
|
|
|
.albumimage img.zoom {
|
|
margin-left: 0px; margin-right: 0px;
|
|
padding-top: 4px; padding-right: 4px; }
|
|
.albumimage img { border: 0px;
|
|
display: block; margin-left: auto; margin-right:auto
|
|
}
|
|
--></style>
|
|
|
|
<!-- no summary found -->
|
|
</head>
|
|
<body>
|
|
|
|
<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 my public
|
|
git repository: <a href="http://git.unpy.net/view?p=wwvbpy.git;a=summary">http://git.unpy.net/view?p=wwvbpy.git;a=summary</a>.
|
|
<br><br><font size=-2>Entry first conceived on 25 July 2011, 13:41 UTC, last modified on 15 January 2012, 3:46 UTC</font>
|
|
</body>
|
|
</html> |