Olivier Mengué

NAME

DateTime::TimeZone::HPUX - Handles timezones defined at the operating system level on HP-UX

VERSION

Version 1.04

SYNOPSIS

On an HP-UX system ($^O eq 'hpux'):

    my $tz =       DateTime::TimeZone->new(name => 'local');

    my $tz_paris = DateTime::TimeZone::HPUX->new(name => 'MET-1METDST');

DESCRIPTION

This distribution implement detection of the local timezone as defined at the operating system level, either in $ENV{TZ} or in /etc/TIMEZONE.

HP-UX has its own system for defining timezones. See tztab(4). This is incompatible with the now common set of timezones known as the Olson DB that is used by DateTime::TimeZone. This module fixes this hole by providing the map between the two systems.

METHODS

new(name => $hpux_style_time_zone)

DateTime::TimeZone factory. Throws an exception if the timezone name could not be resolved.

IMPLEMENTATION

We are using the mapping provided by HP embedded in the Java Runtime Environment:

  • this is the only such map available on HP-UX (the other map I know in /etc/dce_config doesn't uses Olson names)

  • we don't need to bundle our own map that could become obsolete

  • Java is supported by HP, so updated (at least patches are available), so if the local Java has effectively been updated by the lazy administrator (yes, I'm dreaming) DT::TZ::HPUX just has to be reinstalled (force install) and you are not dependent on a new release from its maintainer.

We are using the JRE at the module build time to generate a static Perl package DateTime::TimeZone::HPUX::Map that contains a map of the known timezones defined system wide (/usr/lib/tztab) to Olson DB style timezone names that are known to Java and DateTime::TimeZone.

This extraction is done once for all at install time because JVM startup is SLOOOOOW...

CAVEAT

  • This module uses a map of timezone names to return timezone objects from DateTime::TimeZone. This implies that the TimeZone returned may not directly match the definition found in your /usr/lib/tztab or the timezone in your Java Runtime Environment. I consider this as a feature as DateTime::TimeZone is actively maintained, probaly much more than your local tztab.

  • The module build uses a Java Runtime Environment if it finds one. This JRE must be updated to the latest version with HP's patches for accurate results. If a JRE is not found, a default map will be used but it may not be up to date. If you find mapping problems, first update your JRE and rebuild DT::TZ::HPUX with the environment variable JAVA_HOME pointing to it.

  • The module build use the JAVA_HOME environment variable as the prefered JRE to use. Check that it is pointing to the latest JRE on the machine.

  • If you update the JRE, a new timezone mapping may be available. Security fixes and timezone information updating are the most common cause of the publishing of a new JRE. So reinstalling DateTime::TimeZone::HPUX is advised if you update the JRE.

  • The JRE may also be used at runtime in extreme cases:

    • TZ environment variable is not set and /etc/TIMEZONE is not available as a fallback. The fix is to set $ENV{TZ}.

    • the sources above are avaiable, but have a value that was unknown at the module build time (check DateTime::TimeZone::HPUX::Map). The fix is to rebuild and reinstall the module (cpan force install DateTime::TimeZone::HPUX).

SEE ALSO

BUGS

No known bug at the time of release. The module has an extensive test suite.

Please report any bugs or feature requests to bug-datetime-timezone-hpux at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=DateTime-TimeZone-HPUX. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

However, note that I, Olivier Mengué, will not have access to an HP-UX system past November 30th, 2009. So do not expect any fixes unless you can provide patches yourself.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc DateTime::TimeZone::HPUX

You can also look for information at:

AUTHOR

Olivier Mengué, <dolmen at cpan.org>

COPYRIGHT & LICENSE

Copyright 2009 Olivier Mengué.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl 5.10.0 itself.