diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2010-04-16 12:58:14 -0400 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2010-04-16 12:58:14 -0400 |
commit | d3ee349687e294f84e160ef37610b3b09a0a298e (patch) | |
tree | 00ac5bd6bbbc73d330091d68a08c7d92c58bac4f /devtools | |
parent | e2e31856f98542d79d37111e1a8b6d8d173b2f81 (diff) | |
download | gpsd-d3ee349687e294f84e160ef37610b3b09a0a298e.tar.gz |
Update timebase.h file fom current IERS bulletin.
Also, add an -n option to devtools/leapsecond.py to make this easy.
Update the release checklist in www/haxcking.html.
All regression tests pass.
Diffstat (limited to 'devtools')
-rwxr-xr-x | devtools/leapsecond.py | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/devtools/leapsecond.py b/devtools/leapsecond.py index a2c83136..a658da35 100755 --- a/devtools/leapsecond.py +++ b/devtools/leapsecond.py @@ -94,4 +94,35 @@ def get(): return current_offset if __name__ == '__main__': - print "Current leap second:", retrieve() + import sys, getopt + next = False + (options, arguments) = getopt.getopt(sys.argv[1:], "n:") + for (switch, val) in options: + if (switch == '-n'): # Compute possible next leapsecond + next = True + + if not next: + print "Current leap second:", retrieve() + elif val[:3].lower() not in ("jun", "dec"): + print >>sys.stderr, "leapsecond.py: -n argument must begin with "\ + "'Jun' or 'Dec'" + raise SystemExit, 1 + else: + month = val[:3].lower() + if len(val) != 7: + print >>sys.stderr, "leapsecond.py: -n argument must end "\ + "with a a 4-digit year." + raise SystemExit, 1 + try: + year = int(val[3:]) + except ValueError: + print >>sys.stderr, "leapsecond.py: -n argument must end "\ + "with a 4-digit year." + raise SystemExit, 1 + # Date looks valid + if month == "jun": + fmt = "30 Jun %d 23:59:59" % year + else: + fmt = "31 Dec %d 23:59:59" % year + next = time.mktime(time.strptime(fmt , "%d %b %Y %H:%M:%S")) + print "#define START_SUBFRAME %d /* %s */" % (next, fmt) |