summaryrefslogtreecommitdiff
path: root/leapsecond.py
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2011-08-23 08:52:41 -0400
committerEric S. Raymond <esr@thyrsus.com>2011-08-23 08:52:41 -0400
commit056bce8bc4085405ebae1dc064acac8661ae82e5 (patch)
treeb31c5bb75ad0509e6391135e0001f6b1dd4e6aae /leapsecond.py
parent3409019f38f7a90bd7f00ef6a269cbf243d35476 (diff)
downloadgpsd-056bce8bc4085405ebae1dc064acac8661ae82e5.tar.gz
Add pychecker production for anity-checking Python code.
Diffstat (limited to 'leapsecond.py')
-rwxr-xr-xleapsecond.py9
1 files changed, 1 insertions, 8 deletions
diff --git a/leapsecond.py b/leapsecond.py
index fe2e620f..c9074137 100755
--- a/leapsecond.py
+++ b/leapsecond.py
@@ -113,12 +113,10 @@ def get():
def save_leapseconds(outfile):
"Fetch the USNO leap-second history data and make a leap-second list."
skip = True
- leapsecs = []
try:
fetchobj = urllib.urlopen("ftp://maia.usno.navy.mil/ser7/tai-utc.dat")
# This code assumes that after 1980, leap-second increments are
# always integrally one second and every increment is listed here
- leapsecs = []
fp = open(outfile, "w")
for line in fetchobj:
if line.startswith(" 1980"):
@@ -142,11 +140,6 @@ def fetch_leapsecs(filename):
def make_leapsecond_include(infile):
leapsecs = fetch_leapsecs(infile)
leapsecs.append(time.time()) # Add sentinel
- def label(i):
- if i == len(leapsecs) - 1:
- return '?'
- else:
- return str(i)
year = time.strftime("%Y", time.localtime(time.time()))
return ("#define CENTURY_BASE\t%s00\n" % year[:2]) + ("#define LEAPSECOND_NOW\t%d\n" % (len(leapsecs)-2))
@@ -243,7 +236,7 @@ def leapbound(year, month):
return tv
if __name__ == '__main__':
- import sys, getopt
+ import getopt
(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