Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!mcgill-vision!bloom-beacon!eru!luth!sunic!mcsun!hp4nl!mhres!jv From: jv@mh.nl (Johan Vromans) Newsgroups: comp.lang.perl Subject: ctime.pl (Was: Re: more enhancements?) Message-ID: Date: 16 Mar 90 20:10:25 GMT References: <8017@ogicse.ogi.edu> Sender: news@mhres.mh.nl Organization: Multihouse Gouda, the Netherlands Lines: 43 In-reply-to: jv@mh.nl's message of 15 Mar 90 21:01:07 GMT In article jv@mh.nl (Johan Vromans) writes: > > Someone posted a 'ctime.pl' some time ago. Has anyone archived it? > I have found it, and take the liberty to include it here: ------ start of ctime.pl -- ascii -- complete ------ ;# ctime.pl is a simple Perl emulation for the well known ctime(3C) function. ;# ;# Waldemar Kebsch, Federal Republic of Germany, November 1988 ;# kebsch.pad@nixpbe.UUCP ;# My private System: 80286 with Microport System V/AT 2.2 ;# ;# usage: ;# ;# #include # see Perl library. We need the ;# # environment variable TZ. ;# #include # see the -P and -I option in perl.man ;# $Date = do ctime(time); @DoW = ('Sun','Mon','Tue','Wed','Thu','Fri','Sat'); @MoY = ('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'); sub ctime { local($time) = @_; local($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst); local($date); ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime($time); $year += ($year < 70)? 2000: 1900; $date = sprintf("%s %s %2d %2d:%02d:%02d %s %4d\n", $DoW[$wday], $MoY[$mon], $mday, $hour, $min, $sec, $TZ, $year); return $date; } ------ end of ctime.pl -- ascii -- complete ------ -- 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" -------------------------