DateTime::TimeZone::LMT - A Local Mean Time time zone for DateTime
This documentation refers to DateTime::TimeZone::LMT version 1.01.
# Somewhere in Hawaii
my $tz_lmt = DateTime::TimeZone::LMT->new(
longitude => -174.2342
$now = DateTime->now( time_zone => $tz_lmt );
my $tz_office = DateTime::TimeZone::LMT->new(
name => 'Office',
longitude => -174.2343
$now = DateTime->now( time_zone => 'Office' );
# Relocate office to the neighbourhood of Volgograd
$tz_office->longitude( 45.123 );
This module provides a 'Local Mean Time' timezone for DateTime. Using it you can determine the Mean Time for any location on Earth. Note however that the Mean Time and the Apparent Time (where the sun is in the sky) differ from day to day. This module may account for Local Apparent Time in the future but then again, the Solar:: modules will probably be a better bet.
If you want more information on the difference between LMT and LAT, search the www for 'equation of time', 'analemma' or 'ephemeris'.
(Shameless plug-in) You can for example take a look at the example text sun.pdf in the repository https://github.com/jforget/metaperlualatex.
This module has the following constructor:
new( longitude => $longitude_float, name => $name_string )
Creates a new time zone object usable by DateTime. The zone is calculated to the second for the given longitude.
Eastern longitudes are positive: 0 to +180.
Western longitudes are negative: -180 to 0.
An optional name can be given in order to distinguish between multiple instances. This is the long name accessable via DateTime.
DateTime::TimeZone::LMT objects provide the following accessor methods:
offset_for_datetime( $datetime )
Given an object which implements the DateTime.pm API, this method returns the offset in seconds for the given datetime. For Olson time zones, this takes into account historical time zone information, as well as Daylight Saving Time. The offset is determined by looking at the object's UTC Rata Die days and seconds. For LMT time zones, the historical data and DST are irrelevant.
offset_for_local_datetime( $datetime )
Given an object which implements the DateTime.pm API, this method returns the offset in seconds for the given datetime. Unlike the previous method, this method uses the local time's Rata Die days and seconds. This should only be done when the corresponding UTC time is not yet known, because local times can be ambiguous due to Daylight Saving Time rules.
name( $new_name_string )
Returns the name of the time zone. This is "Local Mean Time" unless the contructor specifies a different name.
If a new name is given, then the object will be changed before being returned.
longitude( $new_longitude_float )
Returns the longitude of the time zone. This is the value specified in the constructor.
If a new longitude is given, then the object will be changed before being returned.
short_name_for_datetime( $datetime )
Returns 'LMT' in all circumstances.
It is strongly recommended that you do not rely on short names for anything other than display.
create_alias( $alias_name );
Creates an alias that can be called as a string by DateTime methods.
This means you can $dt = DateTime->new( time_zone => 'LMT' ) or $dt = DateTime->new( time_zone => 'my alias' ) rather than the normal $dt = DateTime->new( time_zone => $lmt ). This is of little benefit unless you're accepting a time zone name from a user.
$dt = DateTime->new( time_zone => 'LMT' )
$dt = DateTime->new( time_zone => 'my alias' )
$dt = DateTime->new( time_zone => $lmt )
If the optional $alias_name is provided then that will be the alias created. Otherwise the alias is 'LMT'. Multiple aliases can be created from the one object.
If the longitude is changed after an alias is created, then the alias WILL NOT CHANGE. The alias does not behave as an instance of DateTime::TimeZone::LMT.
The following methods always return the same value. They exist in order to make the LMT time zone compatible with the default DateTime::TimeZone modules.
Returns false (0) in all circumstances.
Returns 'Solar' in all circumstances.
This class also contains the following function:
offset_at_longitude( $longitude )
Given a longitude, this method returns a string offset.
This module depends on basic DateTime modules: DateTime and DateTime::TimeZone. It depends also on Params::Validate.
No known bugs.
Support for this module is provided via the firstname.lastname@example.org email list. See http://lists.perl.org/ for more details.
Please submit bugs to the CPAN RT system at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=datetime%3A%3Atimezone%3A%3Almt or via email at email@example.com.
Rick Measham <firstname.lastname@example.org> with parts taken from DateTime::TimeZone by Dave Rolsky <email@example.com>.
Co-maintainer: Jean Forget (JFORGET at cpan dot org).
Copyright (C) 2003, 2016 Rick Measham and Jean Forget. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself: GNU Public License version 1 or later and Perl Artistic License.
The full text of the license can be found in the LICENSE file included with this module or at http://www.perlfoundation.org/artistic_license_1_0 and http://www.gnu.org/licenses/gpl-1.0.html.
Here is the summary of GPL:
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/> or write to the Free Software Foundation, Inc., http://fsf.org.
firstname.lastname@example.org mailing list
To install DateTime::TimeZone::LMT, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell
For more information on module installation, please visit the detailed CPAN module installation guide.