Testsuite: fix problem with parsing retry records spanning midnight.
authorJeremy Harris <jgh146exb@wizmail.org>
Mon, 14 May 2012 23:06:18 +0000 (00:06 +0100)
committerJeremy Harris <jgh146exb@wizmail.org>
Mon, 14 May 2012 23:06:18 +0000 (00:06 +0100)
test/runtest
test/stdout/5100

index a8016cc945ae586a6f4fc988edc135bf7357099e..5f77e625652785b7beea3f5717c25a44ca14af39 100755 (executable)
@@ -18,6 +18,7 @@ require Cwd;
 use Errno;
 use FileHandle;
 use Socket;
 use Errno;
 use FileHandle;
 use Socket;
+use Time::Local;
 
 
 # Start by initializing some global variables
 
 
 # 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)/;
 
 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);
 }
 
 
 }
 
 
index cf3412153ba01e6ff953b1b2f4e6e6e95b07a751..eff877af5f89d330b6f768353c5d56ea7fa20b86 100644 (file)
@@ -1,5 +1,5 @@
 +++++++++++++++++++++++++++
   T:jack@myhost.test.ex -46 12800 LMTP error after end of data: 450 Number 2 is now delayed
 +++++++++++++++++++++++++++
   T:jack@myhost.test.ex -46 12800 LMTP error after end of data: 450 Number 2 is now delayed
-first failed = time last try = time2 next try = time2 + 0
+first failed = time last try = time2 next try = time2 + 86400
   T:tom@myhost.test.ex -44 12800 LMTP error after RCPT TO:<tom@myhost.test.ex>: 450 This one is delayed on RCPT
 first failed = time last try = time2 next try = time2 + 60
   T:tom@myhost.test.ex -44 12800 LMTP error after RCPT TO:<tom@myhost.test.ex>: 450 This one is delayed on RCPT
 first failed = time last try = time2 next try = time2 + 60