xref: /linux/include/uapi/linux/time.h (revision 8dd06ef34b6e2f41b29fbf5fc1663780f2524285)
16f52b16cSGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2607ca46eSDavid Howells #ifndef _UAPI_LINUX_TIME_H
3607ca46eSDavid Howells #define _UAPI_LINUX_TIME_H
4607ca46eSDavid Howells 
5607ca46eSDavid Howells #include <linux/types.h>
6ca5e9abaSDeepa Dinamani #include <linux/time_types.h>
7607ca46eSDavid Howells 
8*c766d147SArnd Bergmann #ifndef __KERNEL__
9607ca46eSDavid Howells #ifndef _STRUCT_TIMESPEC
10607ca46eSDavid Howells #define _STRUCT_TIMESPEC
11607ca46eSDavid Howells struct timespec {
122a785996SArnd Bergmann 	__kernel_old_time_t	tv_sec;		/* seconds */
13607ca46eSDavid Howells 	long			tv_nsec;	/* nanoseconds */
14607ca46eSDavid Howells };
15607ca46eSDavid Howells #endif
16607ca46eSDavid Howells 
17607ca46eSDavid Howells struct timeval {
182a785996SArnd Bergmann 	__kernel_old_time_t	tv_sec;		/* seconds */
19607ca46eSDavid Howells 	__kernel_suseconds_t	tv_usec;	/* microseconds */
20607ca46eSDavid Howells };
21607ca46eSDavid Howells 
22*c766d147SArnd Bergmann struct itimerspec {
23*c766d147SArnd Bergmann 	struct timespec it_interval;/* timer period */
24*c766d147SArnd Bergmann 	struct timespec it_value;	/* timer expiration */
25*c766d147SArnd Bergmann };
26*c766d147SArnd Bergmann 
27*c766d147SArnd Bergmann struct itimerval {
28*c766d147SArnd Bergmann 	struct timeval it_interval;/* timer interval */
29*c766d147SArnd Bergmann 	struct timeval it_value;	/* current value */
30*c766d147SArnd Bergmann };
31*c766d147SArnd Bergmann #endif
32*c766d147SArnd Bergmann 
33607ca46eSDavid Howells struct timezone {
34607ca46eSDavid Howells 	int	tz_minuteswest;	/* minutes west of Greenwich */
35607ca46eSDavid Howells 	int	tz_dsttime;	/* type of dst correction */
36607ca46eSDavid Howells };
37607ca46eSDavid Howells 
38607ca46eSDavid Howells /*
39607ca46eSDavid Howells  * Names of the interval timers, and structure
40607ca46eSDavid Howells  * defining a timer setting:
41607ca46eSDavid Howells  */
42607ca46eSDavid Howells #define	ITIMER_REAL		0
43607ca46eSDavid Howells #define	ITIMER_VIRTUAL		1
44607ca46eSDavid Howells #define	ITIMER_PROF		2
45607ca46eSDavid Howells 
46a84d1169SArnd Bergmann /*
47607ca46eSDavid Howells  * The IDs of the various system clocks (for POSIX.1b interval timers):
48607ca46eSDavid Howells  */
49607ca46eSDavid Howells #define CLOCK_REALTIME			0
50607ca46eSDavid Howells #define CLOCK_MONOTONIC			1
51607ca46eSDavid Howells #define CLOCK_PROCESS_CPUTIME_ID	2
52607ca46eSDavid Howells #define CLOCK_THREAD_CPUTIME_ID		3
53607ca46eSDavid Howells #define CLOCK_MONOTONIC_RAW		4
54607ca46eSDavid Howells #define CLOCK_REALTIME_COARSE		5
55607ca46eSDavid Howells #define CLOCK_MONOTONIC_COARSE		6
56607ca46eSDavid Howells #define CLOCK_BOOTTIME			7
57607ca46eSDavid Howells #define CLOCK_REALTIME_ALARM		8
58607ca46eSDavid Howells #define CLOCK_BOOTTIME_ALARM		9
5907903adaSChristoph Hellwig /*
6007903adaSChristoph Hellwig  * The driver implementing this got removed. The clock ID is kept as a
6107903adaSChristoph Hellwig  * place holder. Do not reuse!
6207903adaSChristoph Hellwig  */
6307903adaSChristoph Hellwig #define CLOCK_SGI_CYCLE			10
641ff3c967SJohn Stultz #define CLOCK_TAI			11
65607ca46eSDavid Howells 
66607ca46eSDavid Howells #define MAX_CLOCKS			16
67607ca46eSDavid Howells #define CLOCKS_MASK			(CLOCK_REALTIME | CLOCK_MONOTONIC)
68607ca46eSDavid Howells #define CLOCKS_MONO			CLOCK_MONOTONIC
69607ca46eSDavid Howells 
70607ca46eSDavid Howells /*
71607ca46eSDavid Howells  * The various flags for setting POSIX.1b interval timers:
72607ca46eSDavid Howells  */
73607ca46eSDavid Howells #define TIMER_ABSTIME			0x01
74607ca46eSDavid Howells 
75607ca46eSDavid Howells #endif /* _UAPI_LINUX_TIME_H */
76