GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  DATETIME::TIMEZONE::LOCAL (3)

.ds Aq ’

NAME

DateTime::TimeZone::Local - Determine the local system’s time zone

CONTENTS

VERSION

version 1.97

SYNOPSIS



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

  my $tz = DateTime::TimeZone::Local->TimeZone();



DESCRIPTION

This module provides an interface for determining the local system’s time zone. Most of the functionality for doing this is in OS-specific subclasses.

USAGE

This class provides the following methods:

DateTime::TimeZone::Local->TimeZone()

This attempts to load an appropriate subclass and asks it to find the local time zone. This method is called by when you pass local as the time zone name to DateTime:TimeZone->new().

If your OS is not explicitly handled, you can create a module with a name of the form DateTime::TimeZone::Local::$^O. If it exists, it will be used instead of falling back to the Unix subclass.

If no OS-specific module exists, we fall back to using the Unix subclass.

See DateTime::TimeZone::Local::Unix, DateTime::TimeZone::Local::Win32, and DateTime::TimeZone::Local::VMS for OS-specific details.

SUBCLASSING

If you want to make a new OS-specific subclass, there are several methods provided by this module you should know about.

CW$class->Methods()

This method should be provided by your class. It should provide a list of methods that will be called to try to determine the local time zone.

Each of these methods is expected to return a new DateTime::TimeZone object if it determines the time zone.

CW$class->FromEnv()

This method tries to find a valid time zone in an %ENV value. It calls $class->EnvVars() to determine which keys to look at.

To use this from a subclass, simply return FromEnv as one of the items from $class->Methods().

CW$class->EnvVars()

This method should be provided by your subclass. It should return a list of env vars to be checked by $class->FromEnv().

CW$class->_IsValidName($name)

Given a possible time zone name, this returns a boolean indicating whether or not the name looks valid. It always return false for local in order to avoid infinite loops.

EXAMPLE SUBCLASS

Here is a simple example subclass:



  package DateTime::TimeZone::SomeOS;

  use strict;
  use warnings;

  use base DateTime::TimeZone::Local;


  sub Methods { qw( FromEnv FromEther ) }

  sub EnvVars { qw( TZ ZONE ) }

  sub FromEther
  {
      my $class = shift;

      ...
  }



SUPPORT

Bugs may be submitted through the RT bug tracker <http://rt.cpan.org/Public/Dist/Display.html?Name=DateTime-TimeZone> (or bug-datetime-timezone@rt.cpan.org <mailto:bug-datetime-timezone@rt.cpan.org>).

I am also usually active on IRC as ’drolsky’ on irc://irc.perl.org.

AUTHOR

Dave Rolsky <autarch@urth.org>

COPYRIGHT AND LICENCE

This software is copyright (c) 2016 by Dave Rolsky.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 DATETIME::TIMEZONE::LOCAL (3) 2016-03-24

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.