Somehow this discussion has gone offtrack from what I've been saying... At 10:56 +0200 98/09/09, Milivoj Ivkovic wrote: > > Anyway, a $TZ would be nice, but the gmtime-localtime difference seems to > be the only _portable_ way of doing it. I'm not exactly asking for portable; I'm asking for a way to replicate the results of `date` :-) -0800 is not quite the same as PST... > Ah, and there's another problem: sometimes the $TZ will not be numeric but > text, Well, yes. That _was_ the gist of my original note. I _know_ I can calculate the offset from GMT. I _want_ the symbolic representation that Unix (Perl) Users expect from date. And, by the way, also expect from strftime(3), and several Perl modules including Date::Manip, Time::Zone, Time::TimeZone, POSIX qw(strftime)... > and possibly ambiguous: BST should be Brazil Standard, but is > sometimes used for British Summer, and others like this... I doubt that it's ambiguous to the people in that timezone :-). The time zone shows up in the current date; it is localized almost by definition. At 03:47 -0700 98/09/09, Larry F. Allen-Tonar wrote: > Timezones? > > Don't be too simplistic. > > Don't forget there there are timezones which are not integer hours > offset from GMT (I recall India is +6 1/2 hours off of GMT or +5 1/2 I haven't forgotten. (There's nothing quite like experiencing a refueling stop in Gander, Newfoundland to give one an appreciation of half-hour timzones ;-) A proper timezone calculator handles this. I know. We did one for A/UX ;-) I can't consider this to be a problem. > TZ is complicated enough, and different enough on the various systems > that do use it, that maybe MacPerl shouldn't mess with it. > from SunOS 5.5.1> man -s 5 environ ... I'm sorry; perhaps I've missed your point. Complex, yes. Complicated, no. And not particularly different on different systems. As the man page shows, it's fairly well standardized. Besides which, _who cares if the symbolic representation is different on different systems as long as it is meaningful and parseable on all systems_? Paul Schinder said (regarding $TZ, aka $ENV{TZ}): > Why? It's not a standard thing, AFAIK, on anything but Windows and > HP-UX (certainly not on Linux or SunOS). Well, maybe not Windows. But actually, it's more standard than you think. The FreeBSD man pages for date and environ reference the TZ environment variable: "The timezone to use when displaying dates. The normal format is a pathname relative to ``/usr/share/zoneinfo''. On a RedHat 5.1 Linux system, man environ shows TZ and TZDIR give time zone information. man date shows %Z time zone (e.g., EDT), or nothing if no time zone is determinable /usr/share/zoneinfo is present and accounted for on both systems Solaris stores the timezone in /etc/TIMEZONE and in $TZ The TZ variable may not be set on all systems, but the concept is quite prevalent across many *nixes. Date::Manip looks for the timezone (in priority order) in $ENV{TZ} main::TZ the Unix date command /etc/TIMEZONE This discussion started because someone wanted to port a script that called `date`. Converting that call to localtime() is only an 86% solution; if for some reason the timezone field is desirable or required... how do you get it on a Mac? AT present, you don't. Maybe I'll write a module to do the appropriate /usr/share/zoneinfo lookup-table magic under Perl... --- Vicki Brown, vlb@cfcl.com |\ _,,,---,,_ Journeyman Sourceror ZZZzz /,`.-'`' -. ;-;;,_ Scripts & Philtres |,4- ) )-,_. ,\ ( `'-' http://www.cfcl.com/~vlb '---''(_/--' `-'\_) P.O. Box 1269 San Bruno, CA 94066 ***** Want to unsubscribe from this list? ***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch