]> git.proxmox.com Git - mirror_spl-debian.git/blame - include/linux-time.h
More build fixes, I have the kernel module almost building and its
[mirror_spl-debian.git] / include / linux-time.h
CommitLineData
3d4ea0ce 1#ifndef _TIME_H
2#define _TIME_H
f1ca4da6 3
4#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.16 */
5
6/*
7 * Structure returned by gettimeofday(2) system call,
8 * and used in other calls.
9 */
10
11#ifdef __cplusplus
12extern "C" {
13#endif
14
15#include <linux/time.h>
3d4ea0ce 16#include <linux-types.h>
f1ca4da6 17
18extern unsigned long long monotonic_clock(void);
19typedef struct timespec timestruc_t; /* definition per SVr4 */
20typedef longlong_t hrtime_t;
21
22#define TIME32_MAX INT32_MAX
23#define TIME32_MIN INT32_MIN
24
25#define SEC 1
26#define MILLISEC 1000
27#define MICROSEC 1000000
28#define NANOSEC 1000000000
29
30#define hz \
31({ \
32 BUG_ON(HZ < 100 || HZ > MICROSEC); \
33 HZ; \
34})
35
36#define gethrestime(ts) getnstimeofday((ts))
37
38static __inline__ hrtime_t
39gethrtime(void) {
40 /* BUG_ON(cur_timer == timer_none); */
41
42 /* Solaris expects a long long here but monotonic_clock() returns an
43 * unsigned long long. Note that monotonic_clock() returns the number
44 * of nanoseconds passed since kernel initialization. Even for a signed
45 * long long this will not "go negative" for ~292 years.
46 */
47 return monotonic_clock();
48}
49
50static __inline__ time_t
51gethrestime_sec(void)
52{
53 timestruc_t now;
54
55 gethrestime(&now);
56 return (now.tv_sec);
57}
58
59
60#ifdef __cplusplus
61}
62#endif
63
3d4ea0ce 64#endif /* _TIME_H */