Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site bonnie.UUCP Path: utzoo!watmath!clyde!bonnie!jww From: jww@bonnie.UUCP (Joel West) Newsgroups: net.sources.mac Subject: Standard time utilities (CORRECTION) Message-ID: <491@bonnie.UUCP> Date: Tue, 28-May-85 10:53:12 EDT Article-I.D.: bonnie.491 Posted: Tue May 28 10:53:12 1985 Date-Received: Thu, 30-May-85 00:22:39 EDT References: <484@bonnie.UUCP> Organization: CACI -- La Jolla, Calif. Lines: 43 A while back, I posted source for a mac-supported time(2), ctime(3), asctime(3), etc. There was one small bug. In a few days, asctime (and ctime) will say Sat Jun 01 01:23 1985 where the standard UNIX ctime says Sat Jun 1 01:23 1985 The patch below (note the "YY" instead of "XX") is a bit kludgey but does the job. Incidentally, this should answer the question of the obnoxious AT&T type who threatened to send the corporate lawyers after me for publishing UNIX source. I mean, geez, if I were going to steal code, at least I'd be able to type it in right! In case I wasn't clear enough before, I have never seen any UNIX source for these, the only thing they have in common with the UNIX version is the documentation, and I do not warrantee their use on a 3B20. :-) XXchar *asctime(utm) XXstruct tm *utm; XX{ static char *monstr = "JanFebMarAprMayJunJulAugSepOctNovDec"; XX static char *daystr = "SunMonTueWedThuFriSat"; XX static char *patstr = "Tue Jan 24 03:55:50 1984\n\0"; XX static char timstr[26]; XX register int num; XX register char *ptr; XX XX strcpy(timstr, patstr); /* set delimiters */ XX strncpy(&timstr[0], &daystr[3*(utm->tm_wday)], 3); XX strncpy(&timstr[4], &monstr[3*(utm->tm_mon)], 3); XX cvt2(timstr[8], utm->tm_mday); YY if (timstr[8] == '0') YY timstr[8] = ' '; XX cvt2(timstr[11], utm->tm_hour); XX cvt2(timstr[14], utm->tm_min); XX cvt2(timstr[17], utm->tm_sec); -- Joel West (619) 457-9681 CACI, Inc. - Federal 3344 N. Torrey Pines Ct La Jolla 92037 jww@bonnie.UUCP (ihnp4!bonnie!jww) westjw@nosc.ARPA And ye can tell the sheep from the men from their frequent use of (tm)....