Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site down.FUN Path: utzoo!watmath!clyde!burl!ulysses!allegra!princeton!down!honey From: honey@down.FUN (Peter Honeyman) Newsgroups: net.sources Subject: Re: date <-> day-number software sought Message-ID: <527@down.FUN> Date: Mon, 8-Jul-85 00:23:45 EDT Article-I.D.: down.527 Posted: Mon Jul 8 00:23:45 1985 Date-Received: Mon, 8-Jul-85 05:36:20 EDT References: <232@bocklin.UUCP> <12900006@inmet.UUCP> Organization: Princeton University, EECS Lines: 33 along similar lines, here's a program (fragment) that converts a date string to the obvious integer. the scope of getdate() is unknown to me, but i use this on ctime format date strings regularly. peter /* * emitc -- convert time into an int. compile with * getdate.o, which can be found with netnews source. */ #include#include #include main(argc, argv) char **argv; { if (argc == 1) printf("%ld\n", time((time_t *) 0)); else { char buf[BUFSIZ], *bptr = buf; *bptr = 0; while (--argc) { strcpy(bptr, *++argv); bptr += strlen(bptr); *bptr++ = ' '; } *--bptr = 0; printf("%ld\n", getdate(buf, (struct timeb *) 0)); } exit(0); }