summaryrefslogtreecommitdiff
path: root/devtools
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2010-04-16 12:58:14 -0400
committerEric S. Raymond <esr@thyrsus.com>2010-04-16 12:58:14 -0400
commitd3ee349687e294f84e160ef37610b3b09a0a298e (patch)
tree00ac5bd6bbbc73d330091d68a08c7d92c58bac4f /devtools
parente2e31856f98542d79d37111e1a8b6d8d173b2f81 (diff)
downloadgpsd-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-xdevtools/leapsecond.py33
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)