nanog mailing list archives
Re: Unix Timestamp
From: woods () weird com (Greg A. Woods)
Date: Mon, 22 Oct 2001 17:08:11 -0400 (EDT)
[ 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>
Current thread:
- Re: Unix Timestamp Steven M. Bellovin (Oct 22)
- <Possible follow-ups>
- Unix Timestamp Brandon Handeland (Oct 22)
- Re: Unix Timestamp Pat Myrto (Oct 22)
- Re: Unix Timestamp Barry Shein (Oct 22)
- Re: Unix Timestamp Greg A. Woods (Oct 22)
- Re: Unix Timestamp Chrisy Luke (Oct 22)
- Re: Unix Timestamp Chris Adams (Oct 22)
- Re: Unix Timestamp Greg A. Woods (Oct 22)
- Re: Unix Timestamp Michael L. Barrow (Oct 22)
- Re: Unix Timestamp Henry Yen (Oct 22)
- Re: Unix Timestamp Owen DeLong (Oct 23)
- Re: Unix Timestamp Pat Myrto (Oct 22)
- Re: Unix Timestamp Nathan Stratton (Oct 22)
- Re: Unix Timestamp Michael L. Barrow (Oct 22)