]> Sergey Matveev's repositories - public-inbox.git/commitdiff
xt/msgtime_cmp: fix false positives from msgtime change
authorEric Wong <e@yhbt.net>
Sat, 4 Apr 2020 23:51:41 +0000 (23:51 +0000)
committerEric Wong <e@yhbt.net>
Sun, 5 Apr 2020 07:25:11 +0000 (07:25 +0000)
commit d857e7dc0d816b635a7ead09c3273f8c2d2434be
("msgtime: assume +0000 if TZ missing when using Date::Parse")
introduced a behavior change which was causes false positives
when compared to the old code.

Update the "old" implementation to match this overdue behavior
change.

xt/msgtime_cmp.t

index b77e57a626958563a0f19e4b17b97bb8a7653113..4ebf5b2cedb85a859b771873452de3d92f95fb2b 100644 (file)
@@ -82,6 +82,13 @@ sub str2date_zone ($) {
 
        # off is the time zone offset in seconds from GMT
        my ($ss,$mm,$hh,$day,$month,$year,$off) = Date::Parse::strptime($date);
 
        # off is the time zone offset in seconds from GMT
        my ($ss,$mm,$hh,$day,$month,$year,$off) = Date::Parse::strptime($date);
+
+       # new behavior which wasn't in the original old version:
+       if ('commit d857e7dc0d816b635a7ead09c3273f8c2d2434be') {
+               # "msgtime: assume +0000 if TZ missing when using Date::Parse"
+               $off //= '+0000';
+       }
+
        return undef unless(defined $off);
 
        # Compute the time zone from offset
        return undef unless(defined $off);
 
        # Compute the time zone from offset