Path: utzoo!attcan!uunet!snorkelwacker!mintaka!ogicse!hakanson From: hakanson@ogicse.ogi.edu (Marion Hakanson) Newsgroups: comp.lang.perl Subject: Re: ctime.pl (Was: Re: more enhancements?) Message-ID: <8095@ogicse.ogi.edu> Date: 19 Mar 90 19:59:10 GMT References: <8017@ogicse.ogi.edu> Organization: Oregon Graduate Institute (formerly OGC), Beaverton, OR Lines: 25 I tried out the posted ctime.pl, which works OK if you don't care what the timezone is. In other words, many hosts are set up to not have the TZ envariable set by default, and ctime.pl uses $ENV{'TZ'} as the timezone string in its output. Note that in many timezones, even if the variable IS set, it's set to something like "PST8PDT", which is not the proper thing to print out in the date. Thus the timezone string is dependent on both the local timezone and on whether it's daylight time (or some other special adjustment is in effect). If one does NOT care about the timezone, then ctime.pl can be modified to call "gmtime" instead of "localtime", and you can just substitute a literal "GMT" or "UCT" for the timezone string. Portable, too. Modern (POSIX-compliant) Unix systems have a "tzfile" which one could pick through to get the timezone name, but older systems would require grunging through kernel structures. In my opinion, the only portable solution (if you care about timezones) is to call the ctime(3) library call. Perhaps it's time to look into building a foreign-function interface -- otherwise Perl will just have to link in every possible library function to satisfy the wants of every programmer. -- Marion Hakanson Domain: hakanson@cse.ogi.edu UUCP : {hp-pcd,tektronix}!ogicse!hakanson