Thread POSIX::mktime erzeugt je nach System unterschiedliche Werte (18 answers)
Opened by Hagen at 2011-01-09 16:51

GwenDragon
 2011-01-10 13:57
#144412 #144412
User since
2005-01-17
14583 Artikel
Admin1
[Homepage]
user image
Mein Testcase:

Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/perl

use strict;
use POSIX qw(mktime);

my $anfang_in = '29.10.2011 08:30';
print "Anfang: '$anfang_in'\n";

print "TZ: ", (join " | ",POSIX::tzname()), "\n";
print "ENV TZ: ", $ENV{TZ}, "\n";

my ($dd, $dm, $dy, $th, $tm, $ts) = split(/[\.: ]/, $anfang_in); 

my $time = POSIX::mktime($ts, $tm, $th, $dd, $dm-1, $dy-1900);

print "\$time aus POSIX::mktime (Ver. $POSIX::VERSION): $time\n",
          "Local: " . localtime($time) . "\n",
          "GMT:   " . gmtime($time) . "\n",


ergibt unter Windows 7:
Anfang: '29.10.2011 08:30'
TZ: Mitteleuropõische Zeit | Mitteleuropõische Sommerzeit
ENV TZ:
$time aus POSIX::mktime (Ver. 1.15): 1319873400
Local: Sat Oct 29 09:30:00 2011
GMT: Sat Oct 29 07:30:00 2011


Unter Ubuntu 10.04:
Anfang: '29.10.2011 08:30'
TZ: GMT | GMT
ENV TZ:
$time aus POSIX::mktime (Ver. 1.13): 1319869800
Local: Sat Oct 29 08:30:00 2011
GMT: Sat Oct 29 06:30:00 2011


Unter RHEL CentOS 5.5:
Anfang: '29.10.2011 08:30'
TZ: GMT | GMT
ENV TZ:
$time aus POSIX::mktime (Ver. 1.09): 1319873400
Local: Sat Oct 29 09:30:00 2011
GMT: Sat Oct 29 07:30:00 2011


Unter Debian-Server 5.0:
Anfang: '29.10.2011 08:30'
TZ: GMT | GMT
ENV TZ:
$time aus POSIX::mktime (Ver. 1.13): 1319869800
Local: Sat Oct 29 08:30:00 2011
GMT: Sat Oct 29 06:30:00 2011


//EDIT:
Finde ich Rätselhaft wieso mein RHEL auf 1319873400 kommt!?

//EDIT2: neues Testprogramm + Ausgaben
Last edited: 2011-01-10 14:09:15 +0100 (CET)
die Drachin Gwendolyn

View full thread POSIX::mktime erzeugt je nach System unterschiedliche Werte