Debian Codegraph @

t/order2.t

raw
1 #!/usr/bin/perl -I. -w
2
3 use strict;
4 use warnings;
5 use Time::ParseDate;
6 use Test::More;
7
8 my $finished;
9 END { ok($finished, 'finished') if defined $finished }
10
11 $ENV{'LANG'} = 'C';
12 $ENV{'TZ'} = 'PST8PDT';
13
14 my @x = localtime(785307957);
15 my @y = gmtime(785307957);
16 my $hd = $y[2] - $x[2];
17 $hd += 24 if $hd < 0;
18 $hd %= 24;
19 if ($hd != 8) {
20 plan skip_all => "It seems localtime() does not honor \$ENV{TZ} when set in the test script. Please set the TZ environment variable to PST8PDT and rerun.";
21 exit 0;
22 }
23 plan qw(no_plan);
24
25 $finished = 0;
26
27 is(parsedate('2009/7/7'), 1246950000, "year 2009");
28 is(parsedate('1918/2/18'), -1636819200, "year 1918");
29
30 $ENV{'TZ'} = 'Europe/Moscow';
31 is(parsedate('2013-05-30'), 1369857600, 'Europe/Moscow, DST permanent 2013');
32 is(parsedate('2009-11-01'), 1257022800, 'Europe/Moscow, DST permanent 2009');
33
34 $finished = 1;
35