summaryrefslogtreecommitdiff
path: root/leapsecond.py
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2011-08-20 07:40:11 -0400
committerEric S. Raymond <esr@thyrsus.com>2011-08-20 07:40:11 -0400
commitb8d12a13c2ed0c77f547d3060cdab9f1c9c51f7c (patch)
tree4dfde169879bbd65b51bee24c796bfecde5970d2 /leapsecond.py
parent2551c7b16d4ff0abc1b33a995122d8c0cd20ff79 (diff)
downloadgpsd-b8d12a13c2ed0c77f547d3060cdab9f1c9c51f7c.tar.gz
Documentation and website update.
Diffstat (limited to 'leapsecond.py')
-rwxr-xr-xleapsecond.py9
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