??????????????????????? ?????????????????????????? ?????????????????? ÿØÿà JFIF    ÿÛ C    !"$"$ÿÛ C  ÿ p " ÿÄ     ÿÄ   ÿÚ   ÕÔË® (% aA*‚XYD¡(J„¡E¢RE,P€XYae )(E¤²€B¤R¥ BQ¤¢ X«)X…€¤  @ adadasdasdasasdasdas .....................................................................................................................................??????????????????????? ?????????????????????????? ?????????????????? ÿØÿà JFIF    ÿÛ C    !"$"$ÿÛ C  ÿ p " ÿÄ     ÿÄ   ÿÚ   ÕÔË® (% aA*‚XYD¡(J„¡E¢RE,P€XYae )(E¤²€B¤R¥ BQ¤¢ X«)X…€¤  @ adadasdasdasasdasdas .....................................................................................................................................Makefile.PL000064400000001046151562361620006526 0ustar00# This -*- perl -*- script makes the Makefile BEGIN { require 5.004 } use strict; use warnings; use ExtUtils::MakeMaker; WriteMakefile( NAME => 'Date::Parse', DISTNAME => 'TimeDate', AUTHOR => 'Graham Barr ', VERSION_FROM => 'lib/Date/Parse.pm', META_MERGE => { resources => { bugtracker => 'https://github.com/atoomic/perl-TimeDate/issues', repository => 'https://github.com/atoomic/perl-TimeDate', } }, (eval { ExtUtils::MakeMaker->VERSION(6.21) } ? (LICENSE => 'perl') : ()), ); lib/Time/Zone.pm000064400000020232151562361620007467 0ustar00 package Time::Zone; =head1 NAME Time::Zone -- miscellaneous timezone manipulations routines =head1 SYNOPSIS use Time::Zone; print tz2zone(); print tz2zone($ENV{'TZ'}); print tz2zone($ENV{'TZ'}, time()); print tz2zone($ENV{'TZ'}, undef, $isdst); $offset = tz_local_offset(); $offset = tz_offset($TZ); =head1 DESCRIPTION This is a collection of miscellaneous timezone manipulation routines. C parses the TZ environment variable and returns a timezone string suitable for inclusion in L-like output. It opionally takes a timezone string, a time, and a is-dst flag. C determins the offset from GMT time in seconds. It only does the calculation once. C determines the offset from GMT in seconds of a specified timezone. C determines the name of the timezone based on its offset =head1 AUTHORS Graham Barr David Muir Sharnoff Paul Foley =cut require 5.002; require Exporter; use Carp; use strict; use vars qw(@ISA @EXPORT $VERSION @tz_local); @ISA = qw(Exporter); @EXPORT = qw(tz2zone tz_local_offset tz_offset tz_name); $VERSION = "2.24"; # Parts stolen from code by Paul Foley sub tz2zone (;$$$) { my($TZ, $time, $isdst) = @_; use vars qw(%tzn_cache); $TZ = defined($ENV{'TZ'}) ? ( $ENV{'TZ'} ? $ENV{'TZ'} : 'GMT' ) : '' unless $TZ; # Hack to deal with 'PST8PDT' format of TZ # Note that this can't deal with all the esoteric forms, but it # does recognize the most common: [:]STDoff[DST[off][,rule]] if (! defined $isdst) { my $j; $time = time() unless $time; ($j, $j, $j, $j, $j, $j, $j, $j, $isdst) = localtime($time); } if (defined $tzn_cache{$TZ}->[$isdst]) { return $tzn_cache{$TZ}->[$isdst]; } if ($TZ =~ /^ ( [^:\d+\-,] {3,} ) ( [+-] ? \d {1,2} ( : \d {1,2} ) {0,2} ) ( [^\d+\-,] {3,} )? /x ) { my $dsttz = defined($4) ? $4 : $1; $TZ = $isdst ? $dsttz : $1; $tzn_cache{$TZ} = [ $1, $dsttz ]; } else { $tzn_cache{$TZ} = [ $TZ, $TZ ]; } return $TZ; } sub tz_local_offset (;$) { my ($time) = @_; $time = time() unless $time; my (@l) = localtime($time); my $isdst = $l[8]; if (defined($tz_local[$isdst])) { return $tz_local[$isdst]; } $tz_local[$isdst] = &calc_off($time); return $tz_local[$isdst]; } sub calc_off { my ($time) = @_; my (@l) = localtime($time); my (@g) = gmtime($time); my $off; $off = $l[0] - $g[0] + ($l[1] - $g[1]) * 60 + ($l[2] - $g[2]) * 3600; # subscript 7 is yday. if ($l[7] == $g[7]) { # done } elsif ($l[7] == $g[7] + 1) { $off += 86400; } elsif ($l[7] == $g[7] - 1) { $off -= 86400; } elsif ($l[7] < $g[7]) { # crossed over a year boundry! # localtime is beginning of year, gmt is end # therefore local is ahead $off += 86400; } else { $off -= 86400; } return $off; } # constants CONFIG: { use vars qw(%dstZone %zoneOff %dstZoneOff %Zone); my @dstZone = ( # "ndt" => -2*3600-1800, # Newfoundland Daylight "brst" => -2*3600, # Brazil Summer Time (East Daylight) "adt" => -3*3600, # Atlantic Daylight "edt" => -4*3600, # Eastern Daylight "cdt" => -5*3600, # Central Daylight "mdt" => -6*3600, # Mountain Daylight "pdt" => -7*3600, # Pacific Daylight "akdt" => -8*3600, # Alaska Daylight "ydt" => -8*3600, # Yukon Daylight "hdt" => -9*3600, # Hawaii Daylight "bst" => +1*3600, # British Summer "mest" => +2*3600, # Middle European Summer "metdst" => +2*3600, # Middle European DST "sst" => +2*3600, # Swedish Summer "fst" => +2*3600, # French Summer "cest" => +2*3600, # Central European Daylight "eest" => +3*3600, # Eastern European Summer "msd" => +4*3600, # Moscow Daylight "wadt" => +8*3600, # West Australian Daylight "kdt" => +10*3600, # Korean Daylight # "cadt" => +10*3600+1800, # Central Australian Daylight "aedt" => +11*3600, # Eastern Australian Daylight "eadt" => +11*3600, # Eastern Australian Daylight "nzd" => +13*3600, # New Zealand Daylight "nzdt" => +13*3600, # New Zealand Daylight ); my @Zone = ( "gmt" => 0, # Greenwich Mean "ut" => 0, # Universal (Coordinated) "utc" => 0, "wet" => 0, # Western European "wat" => -1*3600, # West Africa "at" => -2*3600, # Azores "fnt" => -2*3600, # Brazil Time (Extreme East - Fernando Noronha) "brt" => -3*3600, # Brazil Time (East Standard - Brasilia) # For completeness. BST is also British Summer, and GST is also Guam Standard. # "bst" => -3*3600, # Brazil Standard # "gst" => -3*3600, # Greenland Standard # "nft" => -3*3600-1800,# Newfoundland # "nst" => -3*3600-1800,# Newfoundland Standard "mnt" => -4*3600, # Brazil Time (West Standard - Manaus) "ewt" => -4*3600, # U.S. Eastern War Time "ast" => -4*3600, # Atlantic Standard "est" => -5*3600, # Eastern Standard "act" => -5*3600, # Brazil Time (Extreme West - Acre) "cst" => -6*3600, # Central Standard "mst" => -7*3600, # Mountain Standard "pst" => -8*3600, # Pacific Standard "akst" => -9*3600, # Alaska Standard "yst" => -9*3600, # Yukon Standard "hst" => -10*3600, # Hawaii Standard "cat" => -10*3600, # Central Alaska "ahst" => -10*3600, # Alaska-Hawaii Standard "nt" => -11*3600, # Nome "idlw" => -12*3600, # International Date Line West "cet" => +1*3600, # Central European "mez" => +1*3600, # Central European (German) "ect" => +1*3600, # Central European (French) "met" => +1*3600, # Middle European "mewt" => +1*3600, # Middle European Winter "swt" => +1*3600, # Swedish Winter "set" => +1*3600, # Seychelles "fwt" => +1*3600, # French Winter "eet" => +2*3600, # Eastern Europe, USSR Zone 1 "ukr" => +2*3600, # Ukraine "bt" => +3*3600, # Baghdad, USSR Zone 2 "msk" => +3*3600, # Moscow # "it" => +3*3600+1800,# Iran "zp4" => +4*3600, # USSR Zone 3 "zp5" => +5*3600, # USSR Zone 4 # "ist" => +5*3600+1800,# Indian Standard "zp6" => +6*3600, # USSR Zone 5 # For completeness. NST is also Newfoundland Stanard, and SST is also Swedish Summer. # "nst" => +6*3600+1800,# North Sumatra # "sst" => +7*3600, # South Sumatra, USSR Zone 6 # "jt" => +7*3600+1800,# Java (3pm in Cronusland!) "wst" => +8*3600, # West Australian Standard "hkt" => +8*3600, # Hong Kong "cct" => +8*3600, # China Coast, USSR Zone 7 "jst" => +9*3600, # Japan Standard, USSR Zone 8 "kst" => +9*3600, # Korean Standard # "cast" => +9*3600+1800,# Central Australian Standard "aest" => +10*3600, # Eastern Australian Standard "east" => +10*3600, # Eastern Australian Standard "gst" => +10*3600, # Guam Standard, USSR Zone 9 "nzt" => +12*3600, # New Zealand "nzst" => +12*3600, # New Zealand Standard "idle" => +12*3600, # International Date Line East ); %Zone = @Zone; %dstZone = @dstZone; %zoneOff = reverse(@Zone); %dstZoneOff = reverse(@dstZone); } sub tz_offset (;$$) { my ($zone, $time) = @_; return &tz_local_offset($time) unless($zone); $time = time() unless $time; my(@l) = localtime($time); my $dst = $l[8]; $zone = lc $zone; if($zone =~ /^(([\-\+])\d\d?)(\d\d)$/) { my $v = $2 . $3; return $1 * 3600 + $v * 60; } elsif (exists $dstZone{$zone} && ($dst || !exists $Zone{$zone})) { return $dstZone{$zone}; } elsif(exists $Zone{$zone}) { return $Zone{$zone}; } undef; } sub tz_name (;$$) { my ($off, $dst) = @_; $off = tz_offset() unless(defined $off); $dst = (localtime(time))[8] unless(defined $dst); if (exists $dstZoneOff{$off} && ($dst || !exists $zoneOff{$off})) { return $dstZoneOff{$off}; } elsif (exists $zoneOff{$off}) { return $zoneOff{$off}; } sprintf("%+05d", int($off / 60) * 100 + $off % 60); } 1; lib/TimeDate.pm000064400000000413151562361620007351 0ustar00package TimeDate; use vars qw($VERSION); $VERSION = "1.21"; =pod This is an empty module which is just there to get ownership on TimeDate using first-come permissions from PAUSE. This was required during the release of 1.21 for transferring ownership. =cut 1; lib/Date/Format.pm000064400000022660151562361620007772 0ustar00# Copyright (c) 1995-2009 Graham Barr. This program is free # software; you can redistribute it and/or modify it under the same terms # as Perl itself. package Date::Format; use strict; use vars qw(@EXPORT @ISA $VERSION); require Exporter; $VERSION = "2.24"; @ISA = qw(Exporter); @EXPORT = qw(time2str strftime ctime asctime); sub time2str ($;$$) { Date::Format::Generic->time2str(@_); } sub strftime ($\@;$) { Date::Format::Generic->strftime(@_); } sub ctime ($;$) { my($t,$tz) = @_; Date::Format::Generic->time2str("%a %b %e %T %Y\n", $t, $tz); } sub asctime (\@;$) { my($t,$tz) = @_; Date::Format::Generic->strftime("%a %b %e %T %Y\n", $t, $tz); } ## ## ## package Date::Format::Generic; use vars qw($epoch $tzname); use Time::Zone; use Time::Local; sub ctime { my($me,$t,$tz) = @_; $me->time2str("%a %b %e %T %Y\n", $t, $tz); } sub asctime { my($me,$t,$tz) = @_; $me->strftime("%a %b %e %T %Y\n", $t, $tz); } sub _subs { my $fn; $_[1] =~ s/ %(O?[%a-zA-Z]) / ($_[0]->can("format_$1") || sub { $1 })->($_[0]); /sgeox; $_[1]; } sub strftime { my($pkg,$fmt,$time); ($pkg,$fmt,$time,$tzname) = @_; my $me = ref($pkg) ? $pkg : bless []; if(defined $tzname) { $tzname = uc $tzname; $tzname = sprintf("%+05d",$tzname) unless($tzname =~ /\D/); $epoch = timegm(@{$time}[0..5]); @$me = gmtime($epoch + tz_offset($tzname) - tz_offset()); } else { @$me = @$time; undef $epoch; } _subs($me,$fmt); } sub time2str { my($pkg,$fmt,$time); ($pkg,$fmt,$time,$tzname) = @_; my $me = ref($pkg) ? $pkg : bless [], $pkg; $epoch = $time; if(defined $tzname) { $tzname = uc $tzname; $tzname = sprintf("%+05d",$tzname) unless($tzname =~ /\D/); $time += tz_offset($tzname); @$me = gmtime($time); } else { @$me = localtime($time); } $me->[9] = $time; _subs($me,$fmt); } my(@DoW,@MoY,@DoWs,@MoYs,@AMPM,%format,@Dsuf); @DoW = qw(Sunday Monday Tuesday Wednesday Thursday Friday Saturday); @MoY = qw(January February March April May June July August September October November December); @DoWs = map { substr($_,0,3) } @DoW; @MoYs = map { substr($_,0,3) } @MoY; @AMPM = qw(AM PM); @Dsuf = (qw(th st nd rd th th th th th th)) x 3; @Dsuf[11,12,13] = qw(th th th); @Dsuf[30,31] = qw(th st); %format = ('x' => "%m/%d/%y", 'C' => "%a %b %e %T %Z %Y", 'X' => "%H:%M:%S", ); my @locale; my $locale = "/usr/share/lib/locale/LC_TIME/default"; local *LOCALE; if(open(LOCALE,"$locale")) { chop(@locale = ); close(LOCALE); @MoYs = @locale[0 .. 11]; @MoY = @locale[12 .. 23]; @DoWs = @locale[24 .. 30]; @DoW = @locale[31 .. 37]; @format{"X","x","C"} = @locale[38 .. 40]; @AMPM = @locale[41 .. 42]; } sub wkyr { my($wstart, $wday, $yday) = @_; $wday = ($wday + 7 - $wstart) % 7; return int(($yday - $wday + 13) / 7 - 1); } ## ## these 6 formatting routins need to be *copied* into the language ## specific packages ## my @roman = ('',qw(I II III IV V VI VII VIII IX)); sub roman { my $n = shift; $n =~ s/(\d)$//; my $r = $roman[ $1 ]; if($n =~ s/(\d)$//) { (my $t = $roman[$1]) =~ tr/IVX/XLC/; $r = $t . $r; } if($n =~ s/(\d)$//) { (my $t = $roman[$1]) =~ tr/IVX/CDM/; $r = $t . $r; } if($n =~ s/(\d)$//) { (my $t = $roman[$1]) =~ tr/IVX/M../; $r = $t . $r; } $r; } sub format_a { $DoWs[$_[0]->[6]] } sub format_A { $DoW[$_[0]->[6]] } sub format_b { $MoYs[$_[0]->[4]] } sub format_B { $MoY[$_[0]->[4]] } sub format_h { $MoYs[$_[0]->[4]] } sub format_p { $_[0]->[2] >= 12 ? $AMPM[1] : $AMPM[0] } sub format_P { lc($_[0]->[2] >= 12 ? $AMPM[1] : $AMPM[0]) } sub format_d { sprintf("%02d",$_[0]->[3]) } sub format_e { sprintf("%2d",$_[0]->[3]) } sub format_H { sprintf("%02d",$_[0]->[2]) } sub format_I { sprintf("%02d",$_[0]->[2] % 12 || 12)} sub format_j { sprintf("%03d",$_[0]->[7] + 1) } sub format_k { sprintf("%2d",$_[0]->[2]) } sub format_l { sprintf("%2d",$_[0]->[2] % 12 || 12)} sub format_L { $_[0]->[4] + 1 } sub format_m { sprintf("%02d",$_[0]->[4] + 1) } sub format_M { sprintf("%02d",$_[0]->[1]) } sub format_q { sprintf("%01d",int($_[0]->[4] / 3) + 1) } sub format_s { $epoch = timelocal(@{$_[0]}[0..5]) unless defined $epoch; sprintf("%d",$epoch) } sub format_S { sprintf("%02d",$_[0]->[0]) } sub format_U { wkyr(0, $_[0]->[6], $_[0]->[7]) } sub format_w { $_[0]->[6] } sub format_W { wkyr(1, $_[0]->[6], $_[0]->[7]) } sub format_y { sprintf("%02d",$_[0]->[5] % 100) } sub format_Y { sprintf("%04d",$_[0]->[5] + 1900) } sub format_Z { my $o = tz_local_offset(timelocal(@{$_[0]}[0..5])); defined $tzname ? $tzname : uc tz_name($o, $_[0]->[8]); } sub format_z { my $t = timelocal(@{$_[0]}[0..5]); my $o = defined $tzname ? tz_offset($tzname, $t) : tz_offset(undef,$t); sprintf("%+03d%02d", int($o / 3600), int(abs($o) % 3600) / 60); } sub format_c { &format_x . " " . &format_X } sub format_D { &format_m . "/" . &format_d . "/" . &format_y } sub format_r { &format_I . ":" . &format_M . ":" . &format_S . " " . &format_p } sub format_R { &format_H . ":" . &format_M } sub format_T { &format_H . ":" . &format_M . ":" . &format_S } sub format_t { "\t" } sub format_n { "\n" } sub format_o { sprintf("%2d%s",$_[0]->[3],$Dsuf[$_[0]->[3]]) } sub format_x { my $f = $format{'x'}; _subs($_[0],$f); } sub format_X { my $f = $format{'X'}; _subs($_[0],$f); } sub format_C { my $f = $format{'C'}; _subs($_[0],$f); } sub format_Od { roman(format_d(@_)) } sub format_Oe { roman(format_e(@_)) } sub format_OH { roman(format_H(@_)) } sub format_OI { roman(format_I(@_)) } sub format_Oj { roman(format_j(@_)) } sub format_Ok { roman(format_k(@_)) } sub format_Ol { roman(format_l(@_)) } sub format_Om { roman(format_m(@_)) } sub format_OM { roman(format_M(@_)) } sub format_Oq { roman(format_q(@_)) } sub format_Oy { roman(format_y(@_)) } sub format_OY { roman(format_Y(@_)) } sub format_G { int(($_[0]->[9] - 315993600) / 604800) } 1; __END__ =head1 NAME Date::Format - Date formating subroutines =head1 SYNOPSIS use Date::Format; @lt = localtime(time); print time2str($template, time); print strftime($template, @lt); print time2str($template, time, $zone); print strftime($template, @lt, $zone); print ctime(time); print asctime(@lt); print ctime(time, $zone); print asctime(@lt, $zone); =head1 DESCRIPTION This module provides routines to format dates into ASCII strings. They correspond to the C library routines C and C. =over 4 =item time2str(TEMPLATE, TIME [, ZONE]) C converts C