Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!leah!rpi!sun.soe.clarkson.edu!cline From: cline@sun.soe.clarkson.edu (Marshall Cline) Newsgroups: comp.lang.c Subject: Re: reverse asctime()? EEEK! Message-ID: Date: 7 Jun 89 18:35:18 GMT References: <5178@b11.ingr.com> Sender: news@sun.soe.clarkson.edu Reply-To: cline@sun.soe.clarkson.edu (Marshall Cline) Distribution: usa Organization: Clarkson University, Postdam NY Lines: 44 In-reply-to: abashian@b11.ingr.com's message of 2 Jun 89 03:43:50 GMT In article <5178@b11.ingr.com> abashian@b11.ingr.com (Pete Abashian) writes: >....... I need to be able to take an ascii string and >convert it back to the internal storage - number of seconds since epoch. >The task would normally entail some simple mathematics to incorporate leap >[gag] years, etc... But what about the sticky user(s) that want to be >able to input virtually any valid combination of dates/times? 12MAY89, >12-MAY-89, May 12, 1989....etc. For the life of me I cannot remember EVER >seeing an include file or archive with a reference to such a routine. Don't the "at" and "calendar" utilities do something like that? The "at" syntax for a date/time isn't as general as you'd like. Man page extract from at(1): | Thus legitimate commands include: | at 0815am Jan 24 | at 8:15am Jan 24 | at now + 1 day | at 5 pm Friday The dates syntax of "calendar" is more flexible. From "calendar(1)" man page: |DESCRIPTION | ..................... Most reasonable month-day dates - | such as `Dec. 7,' `december 7,' and `12/7' - are recognized, | but `7 December' or `7/12' are not.......................... "calendar" uses /usr/lib/calendar (an a.out) to figure out todays and tomorrows date. It's an egrep expression, which is (for June 7, 1989): (^|[ (,;])((([Jj]un[^ ]*|\*)[ ]*|(06|6|\*)/)0*7)([^0123456789]|$) (^|[ (,;])((([Jj]un[^ ]*|\*)[ ]*|(06|6|\*)/)0*8)([^0123456789]|$) As EVERYBODY can PLAINLY see, this is a TRIVIAL representation for... well... It's... Ummm... so obvious I don't need to say anything. :-) Anyway, the point is that "calendar" waits until the date shown matches "today"'s date. That's not really what you want. But it may be a start. Marshall -- ________________________________________________________________ Marshall P. Cline ARPA: cline@sun.soe.clarkson.edu ECE Department UseNet: uunet!sun.soe.clarkson.edu!cline Clarkson University BitNet: BH0W@CLUTX Potsdam, NY 13676 AT&T: (315) 268-6591