1989-06-12 15:22:14 +00:00
|
|
|
/*
|
|
|
|
* time - return the current calendar time (seconds since jan 1, 1970)
|
|
|
|
*/
|
1994-06-24 14:02:31 +00:00
|
|
|
/* $Id$ */
|
1989-06-12 15:22:14 +00:00
|
|
|
|
1989-12-18 15:33:48 +00:00
|
|
|
#if defined(__BSD4_2)
|
1989-06-12 15:22:14 +00:00
|
|
|
#include <time.h>
|
1989-12-18 15:33:48 +00:00
|
|
|
/*
|
|
|
|
* Structure returned by gettimeofday(2) system call,
|
|
|
|
* and used in other calls.
|
|
|
|
*/
|
|
|
|
struct timeval {
|
|
|
|
long tv_sec; /* seconds */
|
|
|
|
long tv_usec; /* and microseconds */
|
|
|
|
};
|
|
|
|
|
|
|
|
struct timezone {
|
|
|
|
int tz_minuteswest; /* minutes west of Greenwich */
|
|
|
|
int tz_dsttime; /* type of dst correction */
|
|
|
|
};
|
|
|
|
|
1990-01-22 13:08:36 +00:00
|
|
|
int _gettimeofday(struct timeval *tp, struct timezone *tzp);
|
1989-06-12 15:22:14 +00:00
|
|
|
|
|
|
|
time_t
|
|
|
|
time(time_t *timer)
|
|
|
|
{
|
|
|
|
struct timeval tv;
|
|
|
|
struct timezone tz;
|
1990-01-22 13:08:36 +00:00
|
|
|
_gettimeofday(&tv, &tz);
|
1989-06-12 15:22:14 +00:00
|
|
|
|
|
|
|
if (timer) *timer = tv.tv_sec;
|
|
|
|
return tv.tv_sec;
|
|
|
|
}
|
1989-12-18 15:33:48 +00:00
|
|
|
#else
|
|
|
|
/* Assume time() is a system call */ /* ??? */
|
|
|
|
#endif
|