ports/74042: Perl-5.6.1 does not handle timezone properly

Sergey Potapov sp at bar.alkor.ru
Wed Nov 17 15:40:32 UTC 2004

>Number:         74042
>Category:       ports
>Synopsis:       Perl-5.6.1 does not handle timezone properly
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Nov 17 15:40:31 GMT 2004
>Originator:     Sergey Potapov
>Release:        FreeBSD 5.2.1-RELEASE-p4 i386

System: FreeBSD bar.alkor.ru 5.2.1-RELEASE-p4 FreeBSD 5.2.1-RELEASE-p4 #0: Thu Apr 1 12:35:12 MSD 2004 amil@:/usr/src/sys/i386/compile/MAIL i386

This is perl, v5.6.1 built for i386-freebsd

Copyright 1987-2001, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using `man perl' or `perldoc perl'.  If you have access to the
Internet, point your browser at http://www.perl.com/, the Perl Home Page.


	Perl POSIX::strftime does not handle daylight saving correctly.
	Detail are in "How-To-Repeat".
	It's probably problem of Perl.
	Repeated on 4.10-RELEASE


$ cc -Wall t.c
$ cat t.c # - C program
#include <stdio.h>
#include <time.h>
static void
printtime(time_t t) {
  char buf[256];
  strftime(buf,sizeof(buf),"%F %T %z %Z\n",localtime(&t));
  time_t t = time(NULL);
  t = t - t%(24*3600);
  return 0;
$ cat t.pl # Perl program doing same thing
#!/usr/bin/perl -w
use strict;
use POSIX qw();
my $time = time;
$time = $time - ($time%(24*3600));
my @d0 = localtime($time);
print(POSIX::strftime("%F %T %z %Z\n", at d0));
my @d1 = localtime($time-30*24*3600);
print(POSIX::strftime("%F %T %z %Z\n", at d1));
$ ./a.out
2004-11-17 03:00:00 +0300 MSK
2004-10-18 04:00:00 +0400 MSD
$ perl -w t.pl
2004-11-17 03:00:00 +0300 MSK
2004-10-18 04:00:00 +0300 MSK
$ echo $LANG
$ echo $LC_ALL

Perl's strftime does not provide right timezone offset and name for
daylight saving times. C program works correctly (first date is in
"winter" time, second in "daylight saving").




More information about the freebsd-ports-bugs mailing list