Fix up the time processing, based on time processing fixes from

elsewhere (stupid replicated code; will need to fix in future).

Note that we need the 'compat' module here. Also another fix for
later.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@539 8cb11bc2-c004-0410-86c3-e597b4017df7
remotes/tags/1.0.0-rc1
gstein 2002-09-05 07:11:09 +00:00
parent 7472b19243
commit fd4f86f49d
1 changed files with 14 additions and 3 deletions

View File

@ -22,6 +22,9 @@
import time
import string
### compat isn't in vclib right now. need to work up a solution
import compat
class Sink:
def set_head_revision(self, revision):
@ -137,9 +140,17 @@ class _Parser:
# Convert date into timestamp
date_fields = string.split(date, '.') + ['0', '0', '0']
date_fields = map(string.atoi, date_fields)
if date_fields[0] < 100:
date_fields[0] = date_fields[0] + 1900
timestamp = time.mktime(tuple(date_fields))
# need to make the date four digits for timegm
EPOCH = 1970
if date_fields[0] < EPOCH:
if date_fields[0] < 70:
date_fields[0] = date_fields[0] + 2000
else:
date_fields[0] = date_fields[0] + 1900
if date_fields[0] < EPOCH:
raise ValueError, 'invalid year'
timestamp = compat.timegm(tuple(date_fields))
# Parse author
semi, author, sym = self.ts.mget(3)