correct the date format to match the new format used by the new CVS. the

offset from GMT is also parsed out, but is not currently used. Also, there
is no need to subtract 1900 from the year when passing to timegm(), as it
assumes values over 999 are the actual year.
This commit is contained in:
Thad Ward 2004-06-16 07:36:57 +00:00
parent 6d329e0118
commit 0d6af140b8
2 changed files with 7 additions and 3 deletions

1
TODO
View File

@ -6,6 +6,7 @@ I = in progress
W = waiting on other work
X fix skybox/dome vis problems (workable solution found, needs new renderer)
X It's possible to stick on some obtuse-angled corners qwsv 2.3x didn't
X ~/.quakeforgerc should support all commands, not just set and setrom

View File

@ -891,15 +891,18 @@ sub parse_date_and_author ()
# Parses the date/time and author out of a line like:
#
# date: 1999/02/19 23:29:05; author: apharris; state: Exp;
#
# new line format:
# date: 2001-01-09 05:58:40 +0000; author: taniwha; state: Exp;
my $line = shift;
my ($year, $mon, $mday, $hours, $min, $secs, $author) = $line =~
m#(\d+)/(\d+)/(\d+)\s+(\d+):(\d+):(\d+);\s+author:\s+([^;]+);#
my ($year, $mon, $mday, $hours, $min, $secs, $offset, $author) = $line =~
m#(\d+)-(\d+)-(\d+)\s+(\d+):(\d+):(\d+)\s+([+-]\d+);\s+author:\s+([^;]+);#
or die "Couldn't parse date ``$line''";
die "Bad date or Y2K issues" unless ($year > 1969 and $year < 2258);
# Kinda arbitrary, but useful as a sanity check
my $time = timegm($secs,$min,$hours,$mday,$mon-1,$year-1900);
my $time = timegm($secs,$min,$hours,$mday,$mon-1,$year);
return ($time, $author);
}