Working out type juggling kinks with time
This commit is contained in:
parent
00ea5b516e
commit
238d8e5bd4
1 changed files with 3 additions and 5 deletions
6
tmpufw
6
tmpufw
|
@ -55,9 +55,8 @@ class tmpufw(object):
|
||||||
for line in open(rules_file, 'r'):
|
for line in open(rules_file, 'r'):
|
||||||
# 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)
|
||||||
timestamp, decimal = timestamp.split('.')
|
|
||||||
|
|
||||||
print(str(datetime.fromtimestamp(int(timestamp))) + "\t" + rule)
|
print(str(datetime.fromtimestamp(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:
|
||||||
|
@ -107,7 +106,6 @@ class tmpufw(object):
|
||||||
|
|
||||||
# Removes the PID
|
# Removes the PID
|
||||||
remove(pid_file)
|
remove(pid_file)
|
||||||
|
|
||||||
elif args.rule:
|
elif args.rule:
|
||||||
rules_path = path.dirname(rules_file)
|
rules_path = path.dirname(rules_file)
|
||||||
|
|
||||||
|
@ -116,7 +114,7 @@ class tmpufw(object):
|
||||||
|
|
||||||
# Converts the TTL to a timestamp
|
# Converts the TTL to a timestamp
|
||||||
cal = Calendar()
|
cal = Calendar()
|
||||||
timestamp = mktime(cal.parse(args.ttl)[0])
|
timestamp = int(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