Get the isdst flag from localtime
Perl 6 C Makefile
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib/DateTime
resources Fixing DateTime::DST Nov 1, 2017
src Fix typo in Makefile.in Nov 1, 2017
t Set an explicit timezone in tests Nov 1, 2017
.travis.yml Force Travis to use the best timezone :-p Nov 1, 2017
Build.pm Fixing DateTime::DST Nov 1, 2017
Changes Adding missing Changes Nov 1, 2017
LICENSE Adding LICENSE Jun 30, 2016
META6.json Fixing DateTime::DST Nov 1, 2017
README.md Adding documentation and a README Jun 30, 2016

README.md

NAME

DateTime::DST - make localtime[8] available as is-dst()

SYNOPSIS

use DateTime::DST;

my $non-dst = DateTime.new(:2016year, :1month, :15day, :0hour, :0minute, :0second);
my $dst     = DateTime.new(:2016year, :6month, :15day, :0hour, :0minute, :0second);

say is-dst($non-dst);         # False
say is-dst($non-dst.Instant); # False
say is-dst($non-dst.posix);   # False

say is-dst($dst);             # True
say is-dst($dst.Instant);     # True
say is-dst($dst.posix);       # True

DESCRIPTION

This is nothing too fancy, just exports a function named is-dst which can be used to test for Daylight Savings Time from a DateTime object, an Int (expecting seconds since the start of the POSIX time_t epoch), or an Instant.

FUNCTIONS

is-dst

multi is-dst(Instant $time) returns Bool
multi is-dst(DateTime $time) returns Bool
multi is-dst(Int $time) returns Bool

Returns True if the C-standard library localtime function returns a true value for the DST flag or False otherwise. This is basically the same as localtime($time)[8] in Perl 5.

AUTHOR

Sterling Hanenkamp <hanenkamp@cpan.org>

COPYRIGHT AND LICENSE

Copyright 2016 Andrew Sterling Hanenkamp.

This software is made available under the same terms as Perl 6 itself.