ualarm
[unix-history] / usr / src / lib / libc / gen / ctime.c
index ef3e78f..fb0b3a7 100644 (file)
@@ -4,9 +4,9 @@
  * specifies the terms and conditions for redistribution.
  */
 
  * specifies the terms and conditions for redistribution.
  */
 
-#ifndef lint
-static char sccsid[] = "@(#)ctime.c    5.3 (Berkeley) %G%";
-#endif not lint
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)ctime.c    5.5 (Berkeley) %G%";
+#endif LIBC_SCCS and not lint
 
 /*
  * This routine converts time as follows.
 
 /*
  * This routine converts time as follows.
@@ -159,9 +159,13 @@ time_t *tim;
        int year;
        time_t copyt;
        struct timeval curtime;
        int year;
        time_t copyt;
        struct timeval curtime;
-       struct timezone zone;
+       static struct timezone zone;
+       static int init = 0;
 
 
-       gettimeofday(&curtime, &zone);
+       if (!init) {
+               gettimeofday(&curtime, &zone);
+               init++;
+       }
        copyt = *tim - (time_t)zone.tz_minuteswest*60;
        ct = gmtime(&copyt);
        dayno = ct->tm_yday;
        copyt = *tim - (time_t)zone.tz_minuteswest*60;
        ct = gmtime(&copyt);
        dayno = ct->tm_yday;