diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2011-08-20 07:40:11 -0400 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2011-08-20 07:40:11 -0400 |
commit | b8d12a13c2ed0c77f547d3060cdab9f1c9c51f7c (patch) | |
tree | 4dfde169879bbd65b51bee24c796bfecde5970d2 /leapsecond.py | |
parent | 2551c7b16d4ff0abc1b33a995122d8c0cd20ff79 (diff) | |
download | gpsd-b8d12a13c2ed0c77f547d3060cdab9f1c9c51f7c.tar.gz |
Documentation and website update.
Diffstat (limited to 'leapsecond.py')
-rwxr-xr-x | leapsecond.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/leapsecond.py b/leapsecond.py index b908eecd..fe2e620f 100755 --- a/leapsecond.py +++ b/leapsecond.py @@ -24,6 +24,7 @@ # BSD terms apply: see the file COPYING in the distribution root for details. # import os, urllib, re, random, time, calendar, math, sys +import gps.misc __locations = [ ( @@ -243,7 +244,7 @@ def leapbound(year, month): if __name__ == '__main__': import sys, getopt - (options, arguments) = getopt.getopt(sys.argv[1:], "f:g:h:i:n:o:") + (options, arguments) = getopt.getopt(sys.argv[1:], "f:g:h:i:n:o:I:O:") for (switch, val) in options: if (switch == '-f'): # Fetch USNO data to cache locally save_leapseconds(val) @@ -263,6 +264,12 @@ if __name__ == '__main__': elif (switch == '-o'): # Compute RFC822 date from Unix time print unix_to_rfc822(float(val)) raise SystemExit, 0 + elif (switch == '-I'): # Compute Unix time from ISO8601 date + print gps.misc.isotime(val) + raise SystemExit, 0 + elif (switch == '-O'): # Compute ISO8601 date from Unix time + print gps.misc.isotime(float(val)) + raise SystemExit, 0 print "Current leap second:", retrieve() raise SystemExit, 0 |