NAME

TimeZone::Solar - local solar timezone lookup and utilities including DateTime compatibility

SYNOPSIS

Using TimeZone::Solar alone, with longitude only:

use TimeZone::Solar;
use feature qw(say);

# example without latitude - assumes between 80N and 80S latitude
my $solar_tz = TimeZone::Solar->new( longitude => -121.929 );
say join " ", ( $solar_tz->name, $solar_tz->short_name, $solar_tz->offset,
  $solar_tz->offset_min );

This outputs "Solar/West08 West08 -08:00 -480" using an hour-based time zone.

Using TimeZone::Solar alone, with longitude and latitude:

use TimeZone::Solar;
use feature qw(say);

# example with latitude (location: SJC airport, San Jose, California)
my $solar_tz_lat = TimeZone::Solar->new( latitude => 37.363,
  longitude => -121.929, use_lon_tz => 1 );
say $solar_tz_lat;

This outputs "Solar/Lon122W -08:08" using a longitude-based time zone.

Using TimeZone::Solar with DateTime:

use DateTime;
use TimeZone::Solar;
use feature qw(say);

# noon local solar time at 122W longitude, i.e. San Jose CA or Seattle WA
my $dt = DateTime->new( year => 2022, month => 6, hour => 1,
  time_zone => "Solar/West08" );

# convert to US Pacific Time (works for Standard or Daylight conversion)
$dt->set_time_zone( "US/Pacific" );
say $dt;

This code prints "2022-06-01T13:00:00", which means noon was converted to 1PM, because Solar/West08 is equivalent to US Pacific Standard Time, centered on 120W longitude. And Standard Time is 1 hour off from Daylight Time, which changed noon Solar Time to 1PM Daylight Time.

DESCRIPTION

TimeZone::Solar provides lookup and conversion utilities for Solar time zones, which are based on the longitude of any location on Earth. See the next subsection below for more information.

Through compatibility with DateTime::TimeZone, TimeZone::Solar allows the DateTime module to convert either direction between standard (Olson Database) timezones and Solar time zones.

Overview of Solar time zones

Solar time zones are based on the longitude of a location. Each time zone is defined around having local solar noon, on average, the same as noon on the clock.

Solar time zones are always in Standard Time. There are no Daylight Time changes, by definition. The main point is to have a way to opt out of Daylight Saving Time by using solar time.

The Solar time zones build upon existing standards.

15 degrees of longitude appears more than once above. That isn't a coincidence. It's derived from 360 degrees of rotation in a day, divided by 24 hours in a day. The result is 15 degrees of longitude representing 1 hour in Earth's rotation. That makes each time zone one hour wide. So Solar time zones use that too.

The Solar Time Zones proposal is intended as a potential de-facto standard which people can use in their local areas, providing for routine computational time conversion to and from local standard or daylight time. In order for the proposal to become a de-facto standard, made in force by the number of people using it, it starts with technical early adopters choosing to use it. At some point it would actually become an official alternative via publication of an Internet RFC and adding the new time zones into the Internet Assigned Numbers Authority (IANA) Time Zone Database files. The Time Zone Database feeds the time zone conversions used by computers including servers, desktops, phones and embedded devices.

There are normal variations of a matter of minutes between local solar noon and clock noon, depending on the latitude and time of year. That variation is always the same number of minutes as local solar noon differs from noon UTC at the same latitude on the Prime Meridian (0° longitude), due to seasonal effects of the tilt in Earth's axis relative to our orbit around the Sun.

The Solaer time zones also have another set of overlay time zones the width of 1 degree of longitude, which puts them in 4-minute intervals of time. These are a hyper-local niche for potential use by outdoor events or activities which must be scheduled around daylight. They can also be used by anyone who wants the middle of the scheduling day to coincide closely with local solar noon.

Definition of Solar time zones

The Solar time zones definition includes the following rules.

FUNCTIONS AND METHODS

Class methods

instance methods

DateTime::TimeZone compatibility methods

TimeZone::Solar also overloads the eq (string equality) and "" (convert to string) operators for compatibility with DateTime::TimeZone.

LICENSE

TimeZone::Solar is Open Source software licensed under the GNU General Public License Version 3. See https://www.gnu.org/licenses/gpl-3.0-standalone.html.

SEE ALSO

LongitudeTZ on Github: https://github.com/ikluft/LongitudeTZ

BUGS AND LIMITATIONS

Please report bugs via GitHub at https://github.com/ikluft/LongitudeTZ/issues

Patches and enhancements may be submitted via a pull request at https://github.com/ikluft/LongitudeTZ/pulls