reverse asctime()? EEEK!

Pete Abashian abashian at b11.ingr.com
Fri Jun 2 13:43:50 AEST 1989


Yikes!  For fear that I just fell off the banana boat yesterday,
prepare ye all your flame throwers... 

We all (theoretically) know the function of asctime(); right?
ie:
	long	ltime;
	struct	tm *timedef;
	char	*p;

	ltime = atol(pointer to number of seconds since epoch);
	timedef = localtime(&ltime);
	p = asctime(timedef);

	return(p);

Where p is now a pointer to a string similar to Jun 01, 1989 22:25:00 EST...

Now the problem.  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.

Did I just fall off the boat, or what?

_______________________________________________________________________________
| Jim Kazek, Intergraph Corporation, "It's my bosses opionion that I have none"|
| ingr!e911!jimk     				(205) 464-8690	               || "If you have a Studebaker, I've got a DEC Rainbow for the trunk..."          |+______________________________________________________________________________+



More information about the Comp.lang.c mailing list