[ On Monday, October 22, 2001 at 15:37:46 (-0400), Barry Shein wrote: ]
Subject: Re: Unix Timestamp
% perl5 -e '$x = localtime(1003723200); print "$x\n"
PERL!?!?!? What the heck's the matter with "date"!?!?!?!? 0.0 :-) $ date -r 1003723200 Mon Oct 22 00:00:00 EDT 2001 Just to clarify what I mean by my surprise above: $ time ksh -c 'i=0; while [ $i -lt 100 ] ; do date -r 1003723200 ; : $((i++)) ; done > /dev/null' 5.24s real 0.65s user 4.43s system $ time ksh -c 'i=0; while [ $i -lt 100 ] ; do perl -e '\''$x = localtime(1003723200); print "$x\n"'\'' ; : $((i++)) ; done > /dev/null' 26.72s real 7.48s user 12.64s system (no it's not a fast system, just an old SS2, but it's a great demo of the abuses some people will do with perl) Heck even GNU Awk, one of the usually slower and more gargantuan awks (but the only one with strftime()), does as well or better than 'date': $ time ksh -c 'i=0; while [ $i -lt 10 ] ; do gawk '\''END{print strftime("%c",1003723200)}'\'' < /dev/null ; : $((i++)) ; done > /dev/null' 1.91s real 0.62s user 1.15s system (oddly gawk does consistently better than date in the system and real time, though almost always about the same in the user time -- and one of the reasons this is odd is 'date' is static linked and about 1/2 the size of the dynamic-linked gawk!) -- Greg A. Woods +1 416 218-0098 VE3TCP <gwoods@acm.org> <woods@robohack.ca> Planix, Inc. <woods@planix.com>; Secrets of the Weird <woods@weird.com>