Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!mcsun!hp4nl!mhres!jv From: jv@mh.nl (Johan Vromans) Newsgroups: comp.lang.perl Subject: Re: ctime.pl (Was: Re: more enhancements?) Message-ID: Date: 23 Mar 90 17:26:29 GMT References: <8017@ogicse.ogi.edu> <8095@ogicse.ogi.edu> <8174@ogicse.ogi.edu> Sender: news@mhres.mh.nl Organization: Multihouse Gouda, the Netherlands Lines: 38 In-reply-to: hakanson@ogicse.ogi.edu's message of 22 Mar 90 19:50:17 GMT In article <8174@ogicse.ogi.edu> hakanson@ogicse.ogi.edu (Marion Hakanson) writes: | Here's the previously-posted ctime.pl, with my modifications to | deal with an undefined TZ envariable. There's also a change to print | out the proper portion of a "PST8PDT" format TZ, depending on whether | or not "isdst" is set. At least now it doesn't print out "" for the | timezone, or otherwise mislead you. Please modify lines | # Hack to deal with 'PST8PDT' format of TZ | if ( $TZ =~ /\d+/ ) { | $TZ = $isdst ? $' : $`; | } | $year += ($year < 70) ? 2000 : 1900; | sprintf("%s %s %2d %2d:%02d:%02d %s %4d\n", to | # Hack to deal with 'PST8PDT' format of TZ | if ( $TZ =~ /-?\d+/ ) { ^^ allow leading minus | $TZ = $isdst ? $' : $`; | } | $TZ .= " " unless $TZ eq ""; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ suppress if empty | $year += ($year < 70)? 2000: 1900; | sprintf("%s %s %2d %2d:%02d:%02d %s%4d\n", ^ no space to allow European timezones, e.g. MET-1MET, and empty TZ suppression. Johan -- Johan Vromans jv@mh.nl via internet backbones Multihouse Automatisering bv uucp: ..!{uunet,hp4nl}!mh.nl!jv Doesburgweg 7, 2803 PL Gouda, The Netherlands phone/fax: +31 1820 62944/62500 ------------------------ "Arms are made for hugging" -------------------------