]>
git.proxmox.com Git - mirror_spl-debian.git/blob - include/sys/time.h
341b531ef0e8fa35ac094c600eeb2879f1eac1f5
1 /*****************************************************************************\
2 * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
3 * Copyright (C) 2007 The Regents of the University of California.
4 * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
5 * Written by Brian Behlendorf <behlendorf1@llnl.gov>.
8 * This file is part of the SPL, Solaris Porting Layer.
9 * For details, see <http://github.com/behlendorf/spl/>.
11 * The SPL is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the
13 * Free Software Foundation; either version 2 of the License, or (at your
14 * option) any later version.
16 * The SPL is distributed in the hope that it will be useful, but WITHOUT
17 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 * You should have received a copy of the GNU General Public License along
22 * with the SPL. If not, see <http://www.gnu.org/licenses/>.
23 \*****************************************************************************/
29 * Structure returned by gettimeofday(2) system call,
30 * and used in other calls.
32 #include <linux/module.h>
33 #include <linux/time.h>
34 #include <sys/types.h>
35 #include <sys/timer.h>
37 #if defined(CONFIG_64BIT)
38 #define TIME_MAX INT64_MAX
39 #define TIME_MIN INT64_MIN
41 #define TIME_MAX INT32_MAX
42 #define TIME_MIN INT32_MIN
47 #define MICROSEC 1000000
48 #define NANOSEC 1000000000
50 /* Already defined in include/linux/time.h */
51 #undef CLOCK_THREAD_CPUTIME_ID
53 #undef CLOCK_MONOTONIC
54 #undef CLOCK_PROCESS_CPUTIME_ID
56 typedef enum clock_type
{
57 __CLOCK_REALTIME0
= 0, /* obsolete; same as CLOCK_REALTIME */
58 CLOCK_VIRTUAL
= 1, /* thread's user-level CPU clock */
59 CLOCK_THREAD_CPUTIME_ID
= 2, /* thread's user+system CPU clock */
60 CLOCK_REALTIME
= 3, /* wall clock */
61 CLOCK_MONOTONIC
= 4, /* high resolution monotonic clock */
62 CLOCK_PROCESS_CPUTIME_ID
= 5, /* process's user+system CPU clock */
63 CLOCK_HIGHRES
= CLOCK_MONOTONIC
, /* alternate name */
64 CLOCK_PROF
= CLOCK_THREAD_CPUTIME_ID
,/* alternate name */
69 ASSERT(HZ >= 100 && HZ <= MICROSEC); \
73 extern void __gethrestime(timestruc_t
*);
74 extern int __clock_gettime(clock_type_t
, timespec_t
*);
75 extern hrtime_t
__gethrtime(void);
77 #define gethrestime(ts) __gethrestime(ts)
78 #define clock_gettime(fl, tp) __clock_gettime(fl, tp)
79 #define gethrtime() __gethrtime()
81 static __inline__
time_t
90 #define TIMESPEC_OVERFLOW(ts) \
91 ((ts)->tv_sec < TIME_MIN || (ts)->tv_sec > TIME_MAX)
93 #endif /* _SPL_TIME_H */