Return to BSD News archive
Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!munnari.OZ.AU!spool.mu.edu!uwm.edu!newsfeeds.sol.net!hammer.uoregon.edu!arclight.uoregon.edu!su-news-hub1.bbnplanet.com!news.bbnplanet.com!cpk-news-hub1.bbnplanet.com!cam-news-feed3.bbnplanet.com!das-news2.harvard.edu!news.dfci.harvard.edu!gotd From: gotd@jimmy.harvard.edu (Godfrey Degamo) Newsgroups: comp.unix.programmer,comp.unix.bsd.freebsd.misc Subject: Re: Calculate time from ascii-time Date: 13 Jan 1997 20:05:57 GMT Organization: Dana-Farber Cancer Institute Lines: 31 Message-ID: <5be4j5$ei5@netman-mel.dfci.harvard.edu> References: <5atj3s$cs7@news.euro.net> <5bavlt$2s5@uriah.heep.sax.de> <5bds7r$eh9@elektron.et.tudelft.nl> NNTP-Posting-Host: occams.dfci.harvard.edu X-Newsreader: TIN [version 1.2 PL2] Xref: euryale.cc.adfa.oz.au comp.unix.programmer:48510 comp.unix.bsd.freebsd.misc:33822 M.Boekhold (boekhold@elektron.et.tudelft.nl) wrote: : J Wunsch (j@uriah.heep.sax.de) wrote: : : sake@helpdesk.euronet.nl (Sake Blok) wrote: : : > 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 : : PARSEDATE(3) PARSEDATE(3) : If you don't have this routine, try searching for the source of the 'date' : program from FSF (it's in the shell-utils package). This includes the : getdate()-function mentioned in the previous post. I use it, and it works : great. Or, write the parsing function yourself (not too hard.) that places values in struct tm then call: time_t mktime( struct tm *time_ptr) -Godfrey Degamo, gotd@jimmy.harvard.edu : Maarten : -- : _____________________________________________________________________________ : | Maarten Boekhold, Faculty of Electrical Engineering TU Delft, NL | : | M.Boekhold@et.tudelft.nl boekhold@gopher.library.tudelft.nl | : -----------------------------------------------------------------------------