home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!uknet!cardamom.compnews.co.uk!phil
- From: phil@compnews.co.uk (Phil Male)
- Newsgroups: comp.lang.perl
- Subject: Bug in timelocal
- Summary: timelocal $tzmin incorrect
- Message-ID: <1ifbnpINN8hl@cardamom.compnews.co.uk>
- Date: 6 Jan 93 19:25:45 GMT
- Reply-To: phil@compnews.co.uk
- Organization: Computer Newspaper Services, Howden, UK.
- Lines: 55
- NNTP-Posting-Host: sage.compnews.co.uk
- X-Newsreader: Tin 1.1 PL4
-
- I'm either doing something very stupid here or there is a bug in the timelocal
- package.
-
- From Perl 4.035 lib/timelocal.pl:
-
- CONFIG: {
- package timelocal;
-
- local($[) = 0;
- @epoch = localtime(0);
- $tzmin = $epoch[2] * 60 + $epoch[1]; # minutes east of GMT
- if ($tzmin > 0) {
- $tzmin = 24 * 60 - $tzmin; # minutes west of GMT
- $tzmin -= 24 * 60 if $epoch[5] == 70; # account for the date line
- }
-
- $SEC = 1;
- $MIN = 60 * $SEC;
- $HR = 60 * $MIN;
- $DAYS = 24 * $HR;
- }
-
- This code makes the assumption that the clock offset at localtime(0) is
- equal to the clock offset when $isdst is 0.
-
- from /usr/lib/zoneinfo/europe:
-
- # 1967 March 19 October 29
- # 1968 February 18 October 27
- # "British Standard Time, also one hour ahead of G. M. T., was kept between
- # 1968 Oct. 27-1971 Oct. 31."
- # 1972 March 19 October 29
-
- ..which just happens to be around the epoch.
-
- Now, the point is that at the epoch, according to our Suns and several other
- boxes, time in GB-Eire was one hour ahead of GMT, but DST was not in effect.
- (This could be a bug in the europe definition file of course...)
-
- The problem gets worse because...
-
- $time -= $HR if $test[2] != $_[2];
-
- in timelocal() takes another hour off.
-
- Am I being very stupid, I can't believe that no-one has not spotted this
- before...
-
- --
-
- phil
- ___/ /
- /_/) / Phil Male, Director, Information Systems
- / /_ '/ Computer Newspaper Services, The Bishops Manor, Howden, DN14 7BL
- / / /// +44 43043 Tel: 1100 Fax: 1108/2022 email: phil@compnews.co.uk
-