summaryrefslogtreecommitdiff
path: root/lib/libc/time/time.c
blob: b5f0e44916851ff6d47d607c7f6351e93e2d0ebd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <asm/vdso.h>
#include <time.h>

time_t time(time_t *tloc)
{
	struct timespec ts;

#if defined(__VDSO_TIME)
	if (__vdso_time)
		return __vdso_time(tloc);
#endif

	clock_gettime(CLOCK_REALTIME, &ts);

	if (tloc)
		*tloc = ts.tv_sec;

	return ts.tv_sec;
}