summaryrefslogtreecommitdiff
path: root/test/runtest
diff options
context:
space:
mode:
authorJeremy Harris <jgh146exb@wizmail.org>2012-05-15 00:06:18 +0100
committerJeremy Harris <jgh146exb@wizmail.org>2012-05-15 00:06:18 +0100
commitf675bf30a2ce6242cfc7c3e3997ec5d68a1fca7a (patch)
treeab8a4cdf112266f7f592228cab4ee6a6c89649fa /test/runtest
parent8fd715e80d7848fa463f06951a42967bd7123756 (diff)
Testsuite: fix problem with parsing retry records spanning midnight.
Diffstat (limited to 'test/runtest')
-rwxr-xr-xtest/runtest21
1 files changed, 17 insertions, 4 deletions
diff --git a/test/runtest b/test/runtest
index a8016cc94..5f77e6256 100755
--- a/test/runtest
+++ b/test/runtest
@@ -18,6 +18,7 @@ require Cwd;
use Errno;
use FileHandle;
use Socket;
+use Time::Local;
# Start by initializing some global variables
@@ -210,14 +211,26 @@ return $newid;
}
-# This is used while munging the output from exim_dumpdb. We cheat by assuming
-# that the date always the same, and just return the number of seconds since
-# midnight.
+# This is used while munging the output from exim_dumpdb.
+# May go wrong across DST changes.
sub date_seconds {
my($day,$month,$year,$hour,$min,$sec) =
$_[0] =~ /^(\d\d)-(\w\w\w)-(\d{4})\s(\d\d):(\d\d):(\d\d)/;
-return $hour * 60 * 60 + $min * 60 + $sec;
+my($mon);
+if ($month =~ /Jan/) {$mon = 0;}
+elsif($month =~ /Feb/) {$mon = 1;}
+elsif($month =~ /Mar/) {$mon = 2;}
+elsif($month =~ /Apr/) {$mon = 3;}
+elsif($month =~ /May/) {$mon = 4;}
+elsif($month =~ /Jun/) {$mon = 5;}
+elsif($month =~ /Jul/) {$mon = 6;}
+elsif($month =~ /Aug/) {$mon = 7;}
+elsif($month =~ /Sep/) {$mon = 8;}
+elsif($month =~ /Oct/) {$mon = 9;}
+elsif($month =~ /Nov/) {$mon = 10;}
+elsif($month =~ /Dec/) {$mon = 11;}
+return timelocal($sec,$min,$hour,$day,$mon,$year);
}