Fix FreeBSD build.
[haiku.git] / src / tools / fs_shell / time.cpp
blobe31470f9848bdd17ceb7b5339c9ee83a981a1daf
1 /*
2 * Copyright 2009, Axel Dörfler, axeld@pinc-software.de.
3 * Copyright 2007, Ingo Weinhold, bonefish@cs.tu-berlin.de.
5 * Distributed under the terms of the MIT License.
6 */
8 #include "compatibility.h"
10 #include "fssh_os.h"
11 #include "fssh_time.h"
13 #include <time.h>
14 #include <sys/time.h>
16 #include <OS.h>
19 // #pragma mark - OS.h
21 #if 0
23 void
24 fssh_set_real_time_clock(unsigned long secs_since_jan1_1970)
29 fssh_status_t
30 fssh_set_timezone(char *timezone)
34 #endif // 0
36 unsigned long
37 fssh_real_time_clock(void)
39 timeval tv;
40 gettimeofday(&tv, NULL);
42 return tv.tv_sec;
46 fssh_bigtime_t
47 fssh_real_time_clock_usecs(void)
49 timeval tv;
50 gettimeofday(&tv, NULL);
52 return tv.tv_sec * 1000000LL + tv.tv_usec;
56 fssh_bigtime_t
57 fssh_system_time(void)
59 return system_time();
63 // #pragma mark - time.h
66 fssh_time_t
67 fssh_time(fssh_time_t *timer)
69 time_t result = time(NULL);
70 if (timer)
71 *timer = result;
72 return result;