ack/lang/cem/libcc.ansi/sys/misc/time.c

25 lines
366 B
C
Raw Normal View History

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
#include <stdlib.h>
#include <sys/time.h>
#include <time.h>
#include <ack/config.h>
1989-12-18 15:33:48 +00:00
#if ACKCONF_WANT_EMULATED_TIME
1989-06-12 15:22:14 +00:00
time_t time(time_t* timer)
1989-06-12 15:22:14 +00:00
{
struct timeval tv;
struct timezone tz;
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;
}
1989-12-18 15:33:48 +00:00
#endif