more robust timestamp parsing
Sun Mar 28 18:57:50 UTC 2010 Simon Michael <simon@joyful.com>
* more robust timestamp parsing
With this, darcsweb can list the full darcs repo log.
diff -rN -u old-darcsweb/darcsweb.cgi new-darcsweb/darcsweb.cgi
--- old-darcsweb/darcsweb.cgi 2013-07-18 20:22:13.000000000 +0000
+++ new-darcsweb/darcsweb.cgi 2013-07-18 20:22:13.000000000 +0000
@@ -302,11 +302,12 @@
return time.strptime(s, "%Y%m%d%H%M%S")
except ValueError:
# very old darcs commits use a different format, for example:
- # "Wed May 21 19:39:10 CEST 2003"
- # we can't parse the "CEST" part reliably, so we leave it out
+ # "Wed May 21 19:39:10 CEST 2003" or even:
+ # "Sun Sep 21 07:23:57 Pacific Daylight Time 2003"
+ # we can't parse the time zone part reliably, so we ignore it
fmt = "%a %b %d %H:%M:%S %Y"
parts = s.split()
- ns = ' '.join(parts[0:4]) + ' ' + parts[5]
+ ns = ' '.join(parts[0:4]) + ' ' + parts[-1]
return time.strptime(ns, fmt)