changed system-calls to avoid namespace pollution
This commit is contained in:
parent
0ab62357ce
commit
37c64c6e36
4 changed files with 13 additions and 12 deletions
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue