web/http_headers.py
branchstable
changeset 8081 e8091b415ad8
parent 7855 54283a5b7afc
child 8313 386b6313de28
--- a/web/http_headers.py	Mon Nov 07 18:08:40 2011 +0100
+++ b/web/http_headers.py	Thu Nov 10 23:18:56 2011 +0100
@@ -744,7 +744,8 @@
 
 def generateDateTime(secSinceEpoch):
     """Convert seconds since epoch to HTTP datetime string."""
-    year, month, day, hh, mm, ss, wd, y, z = time.gmtime(secSinceEpoch)
+    # take care gmtime doesn't handle time before epoch (crash on windows at least)
+    year, month, day, hh, mm, ss, wd, y, z = time.gmtime(max(0, secSinceEpoch))
     s = "%s, %02d %3s %4d %02d:%02d:%02d GMT" % (
         weekdayname[wd],
         day, monthname[month], year,