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
|
|
|
|
2007-04-21 23:18:14 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <sys/time.h>
|
|
|
|
#include <time.h>
|
|
|
|
#include <ack/config.h>
|
1989-12-18 15:33:48 +00:00
|
|
|
|
2007-04-21 23:18:14 +00:00
|
|
|
#ifndef ACKCONF_TIME_IS_A_SYSCALL
|
1989-06-12 15:22:14 +00:00
|
|
|
|
|
|
|
time_t
|
2018-06-21 20:33:47 +00:00
|
|
|
time(time_t* timer)
|
1989-06-12 15:22:14 +00:00
|
|
|
{
|
|
|
|
struct timeval tv;
|
|
|
|
struct timezone tz;
|
2007-04-21 23:18:14 +00:00
|
|
|
gettimeofday(&tv, &tz);
|
1989-06-12 15:22:14 +00:00
|
|
|
|
2018-06-21 20:33:47 +00:00
|
|
|
if (timer)
|
|
|
|
*timer = tv.tv_sec;
|
1989-06-12 15:22:14 +00:00
|
|
|
return tv.tv_sec;
|
|
|
|
}
|
2007-04-21 23:18:14 +00:00
|
|
|
|
1989-12-18 15:33:48 +00:00
|
|
|
#endif
|