SPUG: Portable way to get local time zone
John Labovitz
johnl at meer.net
Tue Mar 20 07:46:02 CST 2001
> Does anyone know a 100% portable method for getting the name of the locat time
> zone??
Try the "POSIX" module's tzset() and tzname() subroutines. (Type "man
POSIX" and search for "tzname".) These are identical to the C library
routines, and most Unixes use the same base timezone information & library
(from NIH).
The tzset() subroutine initializes the program to the timezone as specified
in $ENV{TZ}, or whatever is the default on the system. The tzname()
subroutine returns a list of two "short"-style timezone names. Note that
these short names can be ambiguous -- for instance, "EST" stands for
timezones in both eastern Australia and the eastern US.
john
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
POST TO: spug-list at pm.org PROBLEMS: owner-spug-list at pm.org
Subscriptions; Email to majordomo at pm.org: ACTION LIST EMAIL
Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest
Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
More information about the spug-list
mailing list