Bug 137965 - timelocal does not return earliest possible time in eastern hemisphere ?
timelocal does not return earliest possible time in eastern hemisphere ?
Status: CLOSED WONTFIX
Product: Fedora
Classification: Fedora
Component: perl (Show other bugs)
2
i686 Linux
medium Severity medium
: ---
: ---
Assigned To: Warren Togami
David Lawrence
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2004-11-03 08:00 EST by Nils Smeds
Modified: 2007-11-30 17:10 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-09-11 06:42:12 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Nils Smeds 2004-11-03 08:00:57 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3)
Gecko/20040922 Galeon/1.3.16

Description of problem:
According to the perl documentation timelocal should in the case of
ambiguous return values return the earliest possbile time. Ambiguities
arise when the time zone switches from daylight savings time to normal
time. 

http://www.perlpod.com/5.9.1/lib/Time/Local.html
http://www.enstimac.fr/Perl/perl5.8.5/5.8.5/Time/Local.html

It appears to me as if the perl version that comes with Fedora core 2
does not return the earliest possible time in the ambiguous case for
timezones east of Greenwich that uses daylight savings time.

[smeds@nisse-tp FlexLM-version]$ TZ=CET  ./testtime.pl
 Date and time used          One time   Actually returned time
0:14:0 - 104-9-31 [DST=1]   1099174440 1099174440
1:14:0 - 104-9-31 [DST=1]   1099178040 1099178040
2:14:0 - 104-9-31 [DST=1]   1099181640 1099185240 <--- Incorrect result
2:14:0 - 104-9-31 [DST=0]   1099185240 1099185240
3:14:0 - 104-9-31 [DST=0]   1099188840 1099188840

[smeds@nisse-tp FlexLM-version]$ TZ=GB  ./testtime.pl
 Date and time used          One time   Actually returned time
0:14:0 - 104-9-31 [DST=1]   1099178040 1099178040
1:14:0 - 104-9-31 [DST=1]   1099181640 1099185240 <--- Incorrect result
1:14:0 - 104-9-31 [DST=0]   1099185240 1099185240
2:14:0 - 104-9-31 [DST=0]   1099188840 1099188840
3:14:0 - 104-9-31 [DST=0]   1099192440 1099192440

[smeds@nisse-tp FlexLM-version]$ TZ=Asia/Krasnoyarsk  ./testtime.pl
 Date and time used          One time   Actually returned time
0:14:0 - 104-9-31 [DST=1]   1099152840 1099152840
1:14:0 - 104-9-31 [DST=1]   1099156440 1099156440
2:14:0 - 104-9-31 [DST=1]   1099160040 1099163640 <--- Incorrect result
2:14:0 - 104-9-31 [DST=0]   1099163640 1099163640
3:14:0 - 104-9-31 [DST=0]   1099167240 1099167240

[smeds@nisse-tp FlexLM-version]$ TZ=US/Eastern  ./testtime.pl
 Date and time used          One time   Actually returned time
0:14:0 - 104-9-31 [DST=1]   1099196040 1099196040
1:14:0 - 104-9-31 [DST=1]   1099199640 1099199640
1:14:0 - 104-9-31 [DST=0]   1099203240 1099199640
2:14:0 - 104-9-31 [DST=0]   1099206840 1099206840
3:14:0 - 104-9-31 [DST=0]   1099210440 1099210440


Version-Release number of selected component (if applicable):
perl-5.8.3-18

How reproducible:
Always

Steps to Reproduce:
1. TZ=<selected timezone> ./testtime.pl



Actual Results:  For timezones in the northern hemisphere with
daylight savings time and located at or east of Greenwich I get the
marker "Incorrect result"

Expected Results:  The marker "Incorrect result" should never print

Additional info:

#!/usr/bin/perl -w
 
use Time::Local;
 
# Assume a DST time change (clock change 2:59:59 -> 2:00:00) on Oct
31, 2004
my $timestamp=timelocal( 0, 14, 2, 31, 9, 104) ;
 
print " Date and time used          One time   Actually returned time\n";
foreach ( $timestamp - 3*3600, $timestamp - 7200, $timestamp - 3600,
$timestamp, $timestamp + 3600) {
   my ($sec,$min,$hr,$day,$month,$year,$wd,$yd,$dst)=localtime($_);
   my $newtimestamp=timelocal($sec,$min,$hr,$day,$month,$year);
   print "$hr:$min:$sec - $year-$month-$day [DST=$dst]   $_
$newtimestamp" ;
   if($_ < $newtimestamp) { print " <--- Incorrect result" };
   print "\n";
}
Comment 1 Matthew Miller 2005-04-26 11:20:30 EDT
Fedora Core 2 is now maintained by the Fedora Legacy project for
security updates only. If this problem is a security issue, please
reopen and reassign to the Fedora Legacy product. If it is not a
security issue and hasn't been resolved in the current FC3 updates or
in the FC4 test release, reopen and change the version to match.
Comment 2 Warren Togami 2005-09-11 06:42:12 EDT
Closing due to lack of activity and FC2 is no longer supported.  If this is
still an issue in FC3+ please reopen this bug.

Note You need to log in before you can comment on or make changes to this bug.