summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomás Touceda <chiiph@leap.se>2013-03-21 13:40:37 -0300
committerTomás Touceda <chiiph@leap.se>2013-03-22 13:08:49 -0300
commit9bd35a826b398bd3bdd98824f17a14538d14abb8 (patch)
treeb200b784a73f382ee88a6b54f0e035a40275eab4
parent30912fed29fd652f69de5a518cf70e6fe04b04f7 (diff)
Calculate mtime in a more multiplatform way
-rw-r--r--src/leap/util/request_helpers.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/leap/util/request_helpers.py b/src/leap/util/request_helpers.py
index c5d0f3f5..019ff353 100644
--- a/src/leap/util/request_helpers.py
+++ b/src/leap/util/request_helpers.py
@@ -19,6 +19,8 @@
Request helpers for backward compatible "parsing" of requests
"""
+import time
+
import json
from dateutil import parser as dateparser
@@ -50,6 +52,7 @@ def get_content(request):
mtime = None
last_modified = request.headers.get('last-modified', None)
if last_modified:
- mtime = int(dateparser.parse(last_modified).strftime("%s"))
+ dt = dateparser.parse(unicode(last_modified))
+ mtime = int(time.mktime(dt.timetuple()) + dt.microsecond / 1000000.0)
return contents, mtime