*BSD News Article 86405


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!news.cs.su.oz.au!metro!metro!munnari.OZ.AU!news.mel.connect.com.au!news.mel.aone.net.au!grumpy.fl.net.au!news.webspan.net!ix.netcom.com!enews.sgi.com!news.sgi.com!su-news-hub1.bbnplanet.com!news.bbnplanet.com!cam-news-hub1.bbnplanet.com!news-xfer.netaxs.com!insync!uunet!in3.uu.net!194.134.0.82!news.euro.net!helpdesk.euronet.nl!sake
From: sake@helpdesk.euronet.nl (Sake Blok)
Newsgroups: comp.unix.programmer,comp.unix.bsd.freebsd.misc
Subject: Calculate time from ascii-time
Date: 7 Jan 1997 13:29:32 GMT
Organization: EuroNet Internet
Lines: 28
Message-ID: <5atj3s$cs7@news.euro.net>
Reply-To: sake@euro.net
NNTP-Posting-Host: helpdesk.euronet.nl
X-Newsreader: TIN [version 1.2 PL2]
Xref: euryale.cc.adfa.oz.au comp.unix.programmer:48460 comp.unix.bsd.freebsd.misc:33774

Hi,

For processing some log-files I would like to calculate the amount of
seconds since Epoch in a script. The entries in the log-file are of the
following form:   Tue Jan  7 14:07:51 MET 1997

The script itself will be in Perl, so if it can be done (easily) from 
withing Perl, that's great, if not an external program in C will do too.

I think I can use mktime(3) for the purpose but I would think somebody would
already have done so and it feels stupid to invent the wheel all over
again :-)

So if anybody has some sourcecode already for calculating seconds-since-epoch
from an ascii-time-string, I would apreciate it.

Thanks,


Sake
--
     +------------------- There is a purpose to time: --------------------+
     | Sake Blok                                         EuroNet Internet |
     | e-mail: sake@euro.net                          Herengracht 208-214 |
     | http://www.euronet.nl/~sake                     1016 BS  Amsterdam |
     | telephone: +31 (0)20 625 6161                      The Netherlands |
     +---------- It prevents everything from happening at once.-----------+