Cleaned up timestamps
No more stripping the decimal off, casting as a float to remain consistent with time
This commit is contained in:
parent
238d8e5bd4
commit
4ae8542f31
1 changed files with 2 additions and 2 deletions
4
tmpufw
4
tmpufw
|
@ -56,7 +56,7 @@ class tmpufw(object):
|
||||||
# Breaks apart line into expiration timestamp and rule
|
# Breaks apart line into expiration timestamp and rule
|
||||||
timestamp, rule = line.strip("\n").split(' ', 1)
|
timestamp, rule = line.strip("\n").split(' ', 1)
|
||||||
|
|
||||||
print(str(datetime.fromtimestamp(timestamp)) + "\t" + rule)
|
print(str(datetime.fromtimestamp(float(timestamp))) + "\t" + rule)
|
||||||
except IOError:
|
except IOError:
|
||||||
self.error('unable to read from the rules file: ' + rules_file)
|
self.error('unable to read from the rules file: ' + rules_file)
|
||||||
else:
|
else:
|
||||||
|
@ -114,7 +114,7 @@ class tmpufw(object):
|
||||||
|
|
||||||
# Converts the TTL to a timestamp
|
# Converts the TTL to a timestamp
|
||||||
cal = Calendar()
|
cal = Calendar()
|
||||||
timestamp = int(mktime(cal.parse(args.ttl)[0]))
|
timestamp = mktime(cal.parse(args.ttl)[0])
|
||||||
|
|
||||||
# Writes the rule to the rules file
|
# Writes the rule to the rules file
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue