1/*
2 * Copyright 2009, Axel D��rfler, axeld@pinc-software.de.
3 * Copyright 2007, Ingo Weinhold, bonefish@cs.tu-berlin.de.
4 *
5 * Distributed under the terms of the MIT License.
6 */
7
8#include "compatibility.h"
9
10#include "fssh_os.h"
11#include "fssh_time.h"
12
13#include <time.h>
14#include <sys/time.h>
15
16#include <OS.h>
17
18
19// #pragma mark - OS.h
20
21#if 0
22
23void
24fssh_set_real_time_clock(unsigned long secs_since_jan1_1970)
25{
26}
27
28
29fssh_status_t
30fssh_set_timezone(char *timezone)
31{
32}
33
34#endif // 0
35
36unsigned long
37fssh_real_time_clock(void)
38{
39	timeval tv;
40	gettimeofday(&tv, NULL);
41
42	return tv.tv_sec;
43}
44
45
46fssh_bigtime_t
47fssh_real_time_clock_usecs(void)
48{
49	timeval tv;
50	gettimeofday(&tv, NULL);
51
52	return tv.tv_sec * 1000000LL + tv.tv_usec;
53}
54
55
56fssh_bigtime_t
57fssh_system_time(void)
58{
59	return system_time();
60}
61
62
63// #pragma mark - time.h
64
65
66fssh_time_t
67fssh_time(fssh_time_t *timer)
68{
69	time_t result = time(NULL);
70	if (timer)
71		*timer = result;
72	return result;
73}
74