Perl / perl5

🐪 The Perl programming language
https://dev.perl.org/perl5/
Other
1.96k stars 555 forks source link

POSIX strftime always print date/time in GMT #4172

Closed p5pRT closed 20 years ago

p5pRT commented 23 years ago

Migrated from rt.perl.org#7228 (status was 'resolved')

Searchable as RT7228$

p5pRT commented 23 years ago

From olav@melvin.jordforsk.no

In earlier versions (5.6.0)\, I always had to set the environment variable TZ to "GMT" to print (strftime) the real time from my data in a database (stored as seconds since 1 jan 1970)\, but now I get GMT time via strftime although the TZ is set to MET. The follwing script gives date wrong by two hours​:

#!/usr/local/bin/perl

$ENV{TZ} = "MET";

use POSIX;

tzset(); @​tz = tzname(); print "@​tz\n";

$dato = strftime("%Y/%m/%d %T"\,gmtime(time())); print "$dato\n";

Perl Info ``` Flags: category=core severity=medium Site configuration information for perl v5.6.1: Configured by olav at Tue Jun 12 12:35:18 MEST 2001. Summary of my perl5 (revision 5.0 version 6 subversion 1) configuration: Platform: osname=solaris, osvers=2.8, archname=sun4-solaris uname='sunos melvin 5.8 generic_108528-04 sun4u sparc sunw,ultra-5_10 ' config_args='' hint=recommended, useposix=true, d_sigaction=define usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef useperlio=undef d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef Compiler: cc='gcc', ccflags ='-fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64', optimize='-O', cppflags='-fno-strict-aliasing -I/usr/local/include' ccversion='', gccversion='2.95.3 20010315 (release)', gccosandvers='solaris2.8' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=8, usemymalloc=y, prototype=define Linker and Libraries: ld='gcc', ldflags =' -L/usr/local/lib ' libpth=/usr/local/lib /usr/lib /usr/ccs/lib libs=-lsocket -lnsl -lgdbm -ldb -ldl -lm -lc perllibs=-lsocket -lnsl -ldl -lm -lc libc=/lib/libc.so, so=so, useshrplib=false, libperl=libperl.a Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' ' cccdlflags='-fPIC', lddlflags='-G -L/usr/local/lib' Locally applied patches: @INC for perl v5.6.1: /usr/local/lib/perl5/5.6.1/sun4-solaris /usr/local/lib/perl5/5.6.1 /usr/local/lib/perl5/site_perl/5.6.1/sun4-solaris /usr/local/lib/perl5/site_perl/5.6.1 /usr/local/lib/perl5/site_perl/5.6.0/sun4-solaris /usr/local/lib/perl5/site_perl/5.6.0 /usr/local/lib/perl5/site_perl . Environment for perl v5.6.1: HOME=/local/olav LANG=C LANGUAGE (unset) LC_CTYPE=no LC_MONETARY=no LC_TIME=no LD_LIBRARY_PATH=/usr/local/lib:/usr/openwin/lib:/usr/dt/lib:/opt/gnome/lib:/opt/lib:/usr/local/pgplot:/usr/local/pgsql/lib:/usr/local/ssl/lib:/usr/local/adabas/lib:/usr/local/qt/lib:/usr/local/kde/lib:/opt/SUNWns6 LOGDIR (unset) PATH=./:/usr/local/enlightenment/bin:/jmov/src:/usr/openwin/bin:/opt/SUNWns6:/usr/local/teTeX/bin:/usr/local/teTeX/bin/sparc-sun-solaris2.8:/usr/local/bin:/opt/gnome/bin:/opt/bin:/usr/sbin:/usr/bin:/bin:~/bin:~/src:/usr/hosts:/usr/ccs/bin:/usr/ucb:/usr/UAP/cmds:/usr/UAP/bin:/usr/informix/bin:/usr/etc:/usr/local/unixstat:/usr/local/pbm:~/hosts:/usr/local/pgsql/bin:/usr/local/p3d:/opt/SUNWwabi/bin:/usr/local/sybase/bin:/usr/local/jre1.1.8/bin:/usr/local/R/bin:/usr/local/pbmplus:/usr/local/soffice/bin:/usr/local/canna/bin:/usr/local/BerkeleyDB/bin:/usr/local/samba/bin:/usr/local/tnt:/usr/local/Amaya/solaris2/bin:/usr/local/qt/bin:/usr/local/noweb:/usr/local/ssl/bin:/usr/dt/bin:/usr/local/kde/bin:/usr/local/adabas/bin:/usr/local/adabas/pgm:/usr/local/rtf2latex2e PERL_BADLANG (unset) SHELL=/bin/tcsh ```