]> git.proxmox.com Git - mirror_spl-debian.git/blame - include/sys/time.h
Add u8 stub
[mirror_spl-debian.git] / include / sys / time.h
CommitLineData
715f6251 1/*
2 * This file is part of the SPL: Solaris Porting Layer.
3 *
4 * Copyright (c) 2008 Lawrence Livermore National Security, LLC.
5 * Produced at Lawrence Livermore National Laboratory
6 * Written by:
7 * Brian Behlendorf <behlendorf1@llnl.gov>,
8 * Herb Wartens <wartens2@llnl.gov>,
9 * Jim Garlick <garlick@llnl.gov>
10 * UCRL-CODE-235197
11 *
12 * This is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * This is distributed in the hope that it will be useful, but WITHOUT
18 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20 * for more details.
21 *
22 * You should have received a copy of the GNU General Public License along
23 * with this program; if not, write to the Free Software Foundation, Inc.,
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 */
26
09b414e8 27#ifndef _SPL_TIME_H
28#define _SPL_TIME_H
f1ca4da6 29
30/*
31 * Structure returned by gettimeofday(2) system call,
32 * and used in other calls.
33 */
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
f1b59d26 39#include <linux/module.h>
f1ca4da6 40#include <linux/time.h>
f4b37741 41#include <sys/types.h>
f1ca4da6 42
ee476682 43#define TIME32_MAX INT32_MAX
44#define TIME32_MIN INT32_MIN
45
46#define SEC 1
47#define MILLISEC 1000
48#define MICROSEC 1000000
49#define NANOSEC 1000000000
f1ca4da6 50
79b31f36 51/* Already defined in include/linux/time.h */
52#undef CLOCK_THREAD_CPUTIME_ID
53#undef CLOCK_REALTIME
54#undef CLOCK_MONOTONIC
55#undef CLOCK_PROCESS_CPUTIME_ID
56
57typedef enum clock_type {
58 __CLOCK_REALTIME0 = 0, /* obsolete; same as CLOCK_REALTIME */
59 CLOCK_VIRTUAL = 1, /* thread's user-level CPU clock */
60 CLOCK_THREAD_CPUTIME_ID = 2, /* thread's user+system CPU clock */
61 CLOCK_REALTIME = 3, /* wall clock */
62 CLOCK_MONOTONIC = 4, /* high resolution monotonic clock */
63 CLOCK_PROCESS_CPUTIME_ID = 5, /* process's user+system CPU clock */
64 CLOCK_HIGHRES = CLOCK_MONOTONIC, /* alternate name */
65 CLOCK_PROF = CLOCK_THREAD_CPUTIME_ID,/* alternate name */
66} clock_type_t;
67
f1ca4da6 68#define hz \
69({ \
937879f1 70 ASSERT(HZ >= 100 && HZ <= MICROSEC); \
f1ca4da6 71 HZ; \
72})
73
79b31f36 74extern void __gethrestime(timestruc_t *);
75extern int __clock_gettime(clock_type_t, timespec_t *);
76extern hrtime_t __gethrtime(void);
77
78#define gethrestime(ts) __gethrestime(ts)
79#define clock_gettime(fl, tp) __clock_gettime(fl, tp)
80#define gethrtime() __gethrtime()
81
ee476682 82static __inline__ time_t
83gethrestime_sec(void)
84{
85 timestruc_t now;
86
87 __gethrestime(&now);
88 return now.tv_sec;
89}
f1ca4da6 90
f1ca4da6 91#ifdef __cplusplus
92}
93#endif
94
09b414e8 95#endif /* _SPL_TIME_H */