changed system-calls to avoid namespace pollution
authoreck <none@none>
Mon, 22 Jan 1990 13:08:36 +0000 (13:08 +0000)
committereck <none@none>
Mon, 22 Jan 1990 13:08:36 +0000 (13:08 +0000)
lang/cem/libcc.ansi/time/clock.c
lang/cem/libcc.ansi/time/difftime.c
lang/cem/libcc.ansi/time/misc.c
lang/cem/libcc.ansi/time/time.c

index 2b9b08c..4891e65 100644 (file)
@@ -34,7 +34,7 @@ struct rusage {
        long    ru_nivcsw;              /* involuntary context switches */
 };
 
-void getrusage(int who, struct rusage *rusage);
+void _getrusage(int who, struct rusage *rusage);
 
 #elif  defined(_POSIX_SOURCE) || defined(__USG)
 
@@ -45,7 +45,7 @@ struct tms {
        time_t  tms_cstime;             /* system time, children */
 };
 
-long times(struct tms *buffer);
+long _times(struct tms *buffer);
 
 #else                                  /* Version 7 UNIX */
 
@@ -56,7 +56,7 @@ struct tbuffer {
        long child_system_time;
 };
 
-long times(struct tbuffer *buffer);
+long _times(struct tbuffer *buffer);
 
 #endif
 
@@ -66,20 +66,20 @@ clock(void)
 #if    defined(__BSD4_2)
        struct rusage rusage;
 
-       getrusage(RUSAGE_SELF, &rusage);
+       _getrusage(RUSAGE_SELF, &rusage);
 
        return (((unsigned long)rusage.ru_utime.tv_sec * CLOCKS_PER_SEC)
                + rusage.ru_utime.tv_usec);
 #elif  defined(_POSIX_SOURCE) || defined(__USG)
        struct tms tms;
 
-       times(&tms);
+       _times(&tms);
        /* Assume that time_t can be converted to clock_t for Sys5 */
        return tms.tms_utime;
 #else
        struct tbuffer tbuffer;
 
-       times(&tbuffer);
+       _times(&tbuffer);
        return tbuffer.proc_user_time;
 #endif
 }
index 6b1ba72..bf22f74 100644 (file)
@@ -8,6 +8,7 @@
 double
 difftime(time_t time1, time_t time0)
 {
+       /* be careful: time_t is unsigned */
        if (time0 > time1)
                return - (double) (time0 - time1);
        else    return (double) (time1 - time0);
index e221b3b..d5bae4b 100644 (file)
@@ -20,7 +20,7 @@ struct timezone {
        int     tz_dsttime;     /* type of dst correction */
 };
 
-int gettimeofday(struct timeval *tp, struct timezone *tzp);
+int _gettimeofday(struct timeval *tp, struct timezone *tzp);
 
 #elif  !defined(_POSIX_SOURCE) && !defined(__USG)
 #if    !defined(_MINIX)                /* MINIX has no ftime() */
@@ -30,7 +30,7 @@ struct timeb {
        short   timezone;
        short   dstflag;
 };
-void ftime(struct timeb *bp);
+void _ftime(struct timeb *bp);
 #endif
 #endif
 
@@ -279,7 +279,7 @@ _tzset(void)
        struct timeval tv;
        struct timezone tz;
 
-       gettimeofday(&tv, &tz);
+       _gettimeofday(&tv, &tz);
        _daylight = tz.tz_dsttime;
        _timezone = tz.tz_minuteswest * 60;
 
@@ -288,7 +288,7 @@ _tzset(void)
 #if    !defined(_MINIX)                /* MINIX has no ftime() */
        struct timeb time;
 
-       ftime(&time);
+       _ftime(&time);
        _timezone = time.timezone * 60L;
        _daylight = time.dstflag;
 #endif
index ba816c4..c7345a1 100644 (file)
@@ -19,14 +19,14 @@ struct timezone {
        int     tz_dsttime;     /* type of dst correction */
 };
 
-int gettimeofday(struct timeval *tp, struct timezone *tzp);
+int _gettimeofday(struct timeval *tp, struct timezone *tzp);
 
 time_t
 time(time_t *timer)
 {
        struct timeval tv;
        struct timezone tz;
-       gettimeofday(&tv, &tz);
+       _gettimeofday(&tv, &tz);
 
        if (timer) *timer = tv.tv_sec;
        return tv.tv_sec;