add Berkeley specific header; written by Sam Leffler
[unix-history] / usr / src / lib / libc / gen / ctime.c
index 1e2f7ab..38cf27e 100644 (file)
@@ -1,12 +1,26 @@
 /*
  * Copyright (c) 1987 Regents of the University of California.
 /*
  * Copyright (c) 1987 Regents of the University of California.
- * All rights reserved.  The Berkeley software License Agreement
- * specifies the terms and conditions for redistribution.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Arthur Olson.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that the above copyright notice and this paragraph are
+ * duplicated in all such forms and that any documentation,
+ * advertising materials, and other materials related to such
+ * distribution and use acknowledge that the software was developed
+ * by the University of California, Berkeley.  The name of the
+ * University may not be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
 
  */
 
-#ifndef lint
-static char sccsid[] = "@(#)ctime.c    5.7 (Berkeley) %G%";
-#endif
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)ctime.c    5.14 (Berkeley) %G%";
+#endif /* LIBC_SCCS and not lint */
 
 #include "sys/param.h"
 #include "sys/time.h"
 
 #include "sys/param.h"
 #include "sys/time.h"
@@ -39,7 +53,7 @@ register struct tm *  timeptr;
        };
        static char     result[26];
 
        };
        static char     result[26];
 
-       (void) sprintf(result, "%.3s %.3s%3d %.2d:%.2d:%.2d %d\n",
+       (void) sprintf(result, "%.3s %.3s%3d %02d:%02d:%02d %d\n",
                wday_name[timeptr->tm_wday],
                mon_name[timeptr->tm_mon],
                timeptr->tm_mday, timeptr->tm_hour,
                wday_name[timeptr->tm_wday],
                mon_name[timeptr->tm_mon],
                timeptr->tm_mday, timeptr->tm_hour,
@@ -196,7 +210,7 @@ register char *     name;
        */
        tzname[0] = tzname[1] = &s.chars[0];
 #ifdef USG_COMPAT
        */
        tzname[0] = tzname[1] = &s.chars[0];
 #ifdef USG_COMPAT
-       timezone = s.ttis[0].tt_gmtoff;
+       timezone = -s.ttis[0].tt_gmtoff;
        daylight = 0;
 #endif /* USG_COMPAT */
        for (i = 1; i < s.typecnt; ++i) {
        daylight = 0;
 #endif /* USG_COMPAT */
        for (i = 1; i < s.typecnt; ++i) {
@@ -211,7 +225,7 @@ register char *     name;
                } else {
                        tzname[0] = &s.chars[ttisp->tt_abbrind];
 #ifdef USG_COMPAT
                } else {
                        tzname[0] = &s.chars[ttisp->tt_abbrind];
 #ifdef USG_COMPAT
-                       timezone = ttisp->tt_gmtoff;
+                       timezone = -ttisp->tt_gmtoff;
 #endif /* USG_COMPAT */ 
                }
        }
 #endif /* USG_COMPAT */ 
                }
        }
@@ -223,14 +237,14 @@ tzsetkernel()
 {
        struct timeval  tv;
        struct timezone tz;
 {
        struct timeval  tv;
        struct timezone tz;
-       char    *tztab();
+       char    *_tztab();
 
        if (gettimeofday(&tv, &tz))
                return -1;
        s.timecnt = 0;          /* UNIX counts *west* of Greenwich */
        s.ttis[0].tt_gmtoff = tz.tz_minuteswest * -SECS_PER_MIN;
        s.ttis[0].tt_abbrind = 0;
 
        if (gettimeofday(&tv, &tz))
                return -1;
        s.timecnt = 0;          /* UNIX counts *west* of Greenwich */
        s.ttis[0].tt_gmtoff = tz.tz_minuteswest * -SECS_PER_MIN;
        s.ttis[0].tt_abbrind = 0;
-       (void)strcpy(s.chars, tztab(tz.tz_minuteswest, 0));
+       (void)strcpy(s.chars, _tztab(tz.tz_minuteswest, 0));
        tzname[0] = tzname[1] = s.chars;
 #ifdef USG_COMPAT
        timezone = tz.tz_minuteswest * 60;
        tzname[0] = tzname[1] = s.chars;
 #ifdef USG_COMPAT
        timezone = tz.tz_minuteswest * 60;