From 897c4bfc5268f53a9a78219de8a7d2cc6c151f8d Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Wed, 9 Mar 2011 12:18:08 +1300 Subject: [PATCH] Think harder about timestamps. Just save seconds since the epoch as a float. --- libmproxy/utils.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libmproxy/utils.py b/libmproxy/utils.py index 5f0b833d1..6568c445b 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")