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

26 lines
369 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
#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;
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