NAME
Date::Set::Timezones - Date set math with timezones and DST
SYNOPSIS
use Date::Set::Timezone;
$a = Date::Set::Timezone->event( at => '20020311Z' ); # 20020311
# TODO! (see timezone.t for some examples)
DESCRIPTION
Date::Set::Timezone is a module for date/time sets. It allows you to generate groups of dates, like "every wednesday", and then find all the dates matching that pattern. It also allows operations with timezones and daylight saving times.
This module is part of the Reefknot project http://reefknot.sf.net
It requires Date::ICal, Set::Infinite, and Date::Set.
It doesn't include timezones definitions.
RELEASE NOTES
Floating time
Any existing Date::Set or Date::ICal data is interpreted as floating time.
Set data
Data extracted from sets as Date::ICal objects will always come in UTC time.
Floating times are extracted "as-is".
new()
Parameters to new() must be UTC time (with 'Z' at the end). They generate floating times, however.
TIMEZONE METHODS
tz
Returns the set, translated to another timezone. It changes the timezone only. Time values are not changed.
tz( { dst => $new_timezone_set ,
name => ['STD-1', 'DST-1'],
offset => [ 3600, 2*3600 ] } )
This is a function. It doesn't change it's object. It returns a new object.
tz( undef ) returns a set in 'floating time' mode (removes timezone info).
There might be conversion errors nearby DST endings because of 'repeated times' when time 'goes back'.
tz_change
Moves a set to another timezone. It changes both the timezone and time values, and adjusts DST.
tz_change( { dst => $new_timezone_set ,
name => ['STD-1', 'DST-1'],
offset => [ 3600, 2*3600 ] } )
This is a function. It doesn't change it's object. It returns a new object.
tz_change() without a parameter removes the timezone information, moving the time back to 'UTC' and putting the set in 'floating time' mode.
tz_change() of a 'floating time' does not change time values.
DATE::SET METHODS
new
new() behaves differently from Date::Set::new() in that:
$new_set = $set->new();
$new_set receives $set timezone info.
as_string
as_string() behaves differently from Date::Set::as_string() in that it prints timezone/DST info.
offset
offset() behaves differently from Date::Set::offset() in that times are adjusted for timezone/DST.
offset() operates in 'local time' mode. If you need 'UTC time' you should move the set to UTC using tz_change(), then offset() it.
quantize
quantize() behaves differently from Date::Set::quantize() in that times are adjusted for timezone/DST.
quantize() operates in 'local time' mode. If you need 'UTC time' you should move the set to UTC using tz_change(), then quantize() it.
union, intersection, complement, until, contains, intersects
These methods behave differently from Date::Set in that resulting times are adjusted for timezone/DST.
AUTHOR
Flavio Soibelmann Glock <fglock@pucrs.br>
Thanks to Martijn van Beers for help with testing, examples, and API discussions.