diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2011-03-09 12:18:08 +1300 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2011-03-09 12:18:08 +1300 |
commit | 897c4bfc5268f53a9a78219de8a7d2cc6c151f8d (patch) | |
tree | 90d9a469eb37c34f5a558a54014f52e050a9e9c1 | |
parent | 765871bd118926dfb265f2b8f67cfd2b3558d6ee (diff) | |
download | mitmproxy-897c4bfc5268f53a9a78219de8a7d2cc6c151f8d.tar.gz mitmproxy-897c4bfc5268f53a9a78219de8a7d2cc6c151f8d.tar.bz2 mitmproxy-897c4bfc5268f53a9a78219de8a7d2cc6c151f8d.zip |
Think harder about timestamps. Just save seconds since the epoch as a float.
-rw-r--r-- | libmproxy/utils.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/libmproxy/utils.py b/libmproxy/utils.py index 5f0b833d..6568c445 100644 --- a/libmproxy/utils.py +++ b/libmproxy/utils.py @@ -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") |