mirror of
https://github.com/mitmproxy/mitmproxy.git
synced 2024-11-23 21:30:04 +00:00
Think harder about timestamps. Just save seconds since the epoch as a float.
This commit is contained in:
parent
765871bd11
commit
897c4bfc52
@ -16,14 +16,15 @@ import re, os, subprocess, datetime, textwrap, errno, sys, time, pytz
|
||||
|
||||
|
||||
def timestamp():
|
||||
d = datetime.datetime.utcnow()
|
||||
return list(d.timetuple())
|
||||
"""
|
||||
Returns a serializable UTC timestamp.
|
||||
"""
|
||||
return time.time()
|
||||
|
||||
|
||||
def format_timestamp(s):
|
||||
s = time.struct_time(s)
|
||||
s = time.localtime(s)
|
||||
d = datetime.datetime.fromtimestamp(time.mktime(s))
|
||||
d = d - datetime.timedelta(seconds=time.altzone)
|
||||
return d.strftime("%Y-%m-%d %H:%M:%S")
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user