File: order2.t

package info (click to toggle)
libtime-parsedate-perl 2015.103-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 176 kB
  • sloc: perl: 1,926; makefile: 2
file content (35 lines) | stat: -rw-r--r-- 848 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/perl -I. -w

use strict;
use warnings;
use Time::ParseDate;
use Test::More;

my $finished;
END { ok($finished, 'finished') if defined $finished }

$ENV{'LANG'} = 'C';
$ENV{'TZ'} = 'PST8PDT'; 

my @x = localtime(785307957);
my @y = gmtime(785307957);
my $hd = $y[2] - $x[2];
$hd += 24 if $hd < 0;
$hd %= 24;
if ($hd != 8) {
	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.";
	exit 0;
}
plan qw(no_plan);

$finished = 0;

is(parsedate('2009/7/7'), 1246950000, "year 2009");
is(parsedate('1918/2/18'), -1636819200, "year 1918");

$ENV{'TZ'} = 'Europe/Moscow';
is(parsedate('2013-05-30'), 1369857600, 'Europe/Moscow, DST permanent 2013');
is(parsedate('2009-11-01'), 1257022800, 'Europe/Moscow, DST permanent 2009');

$finished = 1;