View | Details | Raw Unified | Return to bug 256941 | Differences between
and this patch

Collapse All | Expand All

(-)b/include/time.h (-29 / +1 lines)
Lines 46-51 Link Here
46
#include <sys/cdefs.h>
46
#include <sys/cdefs.h>
47
#include <sys/_null.h>
47
#include <sys/_null.h>
48
#include <sys/_types.h>
48
#include <sys/_types.h>
49
#include <sys/_clock_id.h>
49
50
50
#if __POSIX_VISIBLE > 0 && __POSIX_VISIBLE < 200112 || __BSD_VISIBLE
51
#if __POSIX_VISIBLE > 0 && __POSIX_VISIBLE < 200112 || __BSD_VISIBLE
51
/*
52
/*
Lines 97-131 typedef __pid_t pid_t; Link Here
97
#endif
98
#endif
98
#endif
99
#endif
99
100
100
/* These macros are also in sys/time.h. */
101
#if !defined(CLOCK_REALTIME) && __POSIX_VISIBLE >= 199506
102
#define CLOCK_REALTIME	0
103
#endif /* !defined(CLOCK_REALTIME) && __POSIX_VISIBLE >= 199506 */
104
#if !defined(CLOCK_VIRTUAL) && __BSD_VISIBLE
105
#define CLOCK_VIRTUAL	1
106
#define CLOCK_PROF	2
107
#endif /* !defined(CLOCK_VIRTUAL) && __BSD_VISIBLE */
108
#if !defined(CLOCK_MONOTONIC) && __POSIX_VISIBLE >= 200112
109
#define CLOCK_MONOTONIC	4
110
#define CLOCK_UPTIME	5		/* FreeBSD-specific. */
111
#define CLOCK_UPTIME_PRECISE	7	/* FreeBSD-specific. */
112
#define CLOCK_UPTIME_FAST	8	/* FreeBSD-specific. */
113
#define CLOCK_REALTIME_PRECISE	9	/* FreeBSD-specific. */
114
#define CLOCK_REALTIME_FAST	10	/* FreeBSD-specific. */
115
#define CLOCK_MONOTONIC_PRECISE	11	/* FreeBSD-specific. */
116
#define CLOCK_MONOTONIC_FAST	12	/* FreeBSD-specific. */
117
#define CLOCK_SECOND	13		/* FreeBSD-specific. */
118
#define CLOCK_THREAD_CPUTIME_ID	14
119
#define	CLOCK_PROCESS_CPUTIME_ID	15
120
#endif /* !defined(CLOCK_MONOTONIC) && __POSIX_VISIBLE >= 200112 */
121
122
#if __BSD_VISIBLE
123
#define TIMER_RELTIME	0x0	/* relative timer */
124
#endif
125
#if !defined(TIMER_ABSTIME) && __POSIX_VISIBLE >= 199506
126
#define TIMER_ABSTIME	0x1	/* absolute timer */
127
#endif /* !defined(TIMER_ABSTIME) && __POSIX_VISIBLE >= 199506 */
128
129
struct tm {
101
struct tm {
130
	int	tm_sec;		/* seconds after the minute [0-60] */
102
	int	tm_sec;		/* seconds after the minute [0-60] */
131
	int	tm_min;		/* minutes after the hour [0-59] */
103
	int	tm_min;		/* minutes after the hour [0-59] */
(-)b/lib/libc/sys/clock_gettime.2 (-1 / +14 lines)
Lines 29-35 Link Here
29
.\"
29
.\"
30
.\" $FreeBSD$
30
.\" $FreeBSD$
31
.\"
31
.\"
32
.Dd May 13, 2021
32
.Dd July 1, 2021
33
.Dt CLOCK_GETTIME 2
33
.Dt CLOCK_GETTIME 2
34
.Os
34
.Os
35
.Sh NAME
35
.Sh NAME
Lines 68-81 as well as the following values: Link Here
68
.It Dv CLOCK_REALTIME
68
.It Dv CLOCK_REALTIME
69
.It Dv CLOCK_REALTIME_PRECISE
69
.It Dv CLOCK_REALTIME_PRECISE
70
.It Dv CLOCK_REALTIME_FAST
70
.It Dv CLOCK_REALTIME_FAST
71
.It Dv CLOCK_REALTIME_COARSE
71
Increments as a wall clock should.
72
Increments as a wall clock should.
72
.It Dv CLOCK_MONOTONIC
73
.It Dv CLOCK_MONOTONIC
73
.It Dv CLOCK_MONOTONIC_PRECISE
74
.It Dv CLOCK_MONOTONIC_PRECISE
74
.It Dv CLOCK_MONOTONIC_FAST
75
.It Dv CLOCK_MONOTONIC_FAST
76
.It Dv CLOCK_MONOTONIC_COARSE
75
Increments in SI seconds.
77
Increments in SI seconds.
76
.It Dv CLOCK_UPTIME
78
.It Dv CLOCK_UPTIME
77
.It Dv CLOCK_UPTIME_PRECISE
79
.It Dv CLOCK_UPTIME_PRECISE
78
.It Dv CLOCK_UPTIME_FAST
80
.It Dv CLOCK_UPTIME_FAST
81
.It Dv CLOCK_BOOTTIME
79
Starts at zero when the kernel boots and increments
82
Starts at zero when the kernel boots and increments
80
monotonically in SI seconds while the machine is running.
83
monotonically in SI seconds while the machine is running.
81
.It Dv CLOCK_VIRTUAL
84
.It Dv CLOCK_VIRTUAL
Lines 104-109 Similarly, Link Here
104
.Fa CLOCK_UPTIME_PRECISE
107
.Fa CLOCK_UPTIME_PRECISE
105
are used to get the most exact value as possible, at the expense of
108
are used to get the most exact value as possible, at the expense of
106
execution time.
109
execution time.
110
The clock IDs
111
.Fa CLOCK_REALTIME_COARSE ,
112
.Fa CLOCK_MONOTONIC_COARSE
113
are aliases of corresponding IDs with _FAST suffix for compatibility with other
114
systems.
115
Finally,
116
.Dv CLOCK_BOOTTIME
117
is an alias for
118
.Dv CLOCK_UPTIME
119
for compatibility with other systems.
107
.Pp
120
.Pp
108
The structure pointed to by
121
The structure pointed to by
109
.Fa tp
122
.Fa tp
(-)b/sys/sys/_clock_id.h (+81 lines)
Added Link Here
1
/*-
2
 * SPDX-License-Identifier: BSD-3-Clause
3
 *
4
 * Copyright (c) 1989, 1993
5
 *	The Regents of the University of California.  All rights reserved.
6
 * (c) UNIX System Laboratories, Inc.
7
 * All or some portions of this file are derived from material licensed
8
 * to the University of California by American Telephone and Telegraph
9
 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
10
 * the permission of UNIX System Laboratories, Inc.
11
 *
12
 * Redistribution and use in source and binary forms, with or without
13
 * modification, are permitted provided that the following conditions
14
 * are met:
15
 * 1. Redistributions of source code must retain the above copyright
16
 *    notice, this list of conditions and the following disclaimer.
17
 * 2. Redistributions in binary form must reproduce the above copyright
18
 *    notice, this list of conditions and the following disclaimer in the
19
 *    documentation and/or other materials provided with the distribution.
20
 * 3. Neither the name of the University nor the names of its contributors
21
 *    may be used to endorse or promote products derived from this software
22
 *    without specific prior written permission.
23
 *
24
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34
 * SUCH DAMAGE.
35
 *
36
 *	@(#)time.h	8.3 (Berkeley) 1/21/94
37
 */
38
39
#ifndef _SYS_SYS__CLOCK_ID_H
40
#define	_SYS_SYS__CLOCK_ID_H
41
42
/* These macros are shared between time.h and sys/time.h. */
43
#if __POSIX_VISIBLE >= 199506
44
#define CLOCK_REALTIME		0
45
#endif /* __POSIX_VISIBLE >= 199506 */
46
#ifdef __BSD_VISIBLE
47
#define CLOCK_VIRTUAL		1
48
#define CLOCK_PROF		2
49
#endif /* __BSD_VISIBLE */
50
#if __POSIX_VISIBLE >= 200112
51
#define CLOCK_MONOTONIC		4
52
#endif /* __POSIX_VISIBLE >= 200112 */
53
#ifdef __BSD_VISIBLE
54
#define CLOCK_UPTIME		5	/* FreeBSD-specific. */
55
#define CLOCK_UPTIME_PRECISE	7	/* FreeBSD-specific. */
56
#define CLOCK_UPTIME_FAST	8	/* FreeBSD-specific. */
57
#define CLOCK_REALTIME_PRECISE	9	/* FreeBSD-specific. */
58
#define CLOCK_REALTIME_FAST	10	/* FreeBSD-specific. */
59
#define CLOCK_MONOTONIC_PRECISE	11	/* FreeBSD-specific. */
60
#define CLOCK_MONOTONIC_FAST	12	/* FreeBSD-specific. */
61
#define CLOCK_SECOND		13	/* FreeBSD-specific. */
62
#endif /* __BSD_VISIBLE */
63
#if __POSIX_VISIBLE >= 200112
64
#define CLOCK_THREAD_CPUTIME_ID	14
65
#define	CLOCK_PROCESS_CPUTIME_ID 15
66
#endif /* __POSIX_VISIBLE >= 200112 */
67
68
#if __BSD_VISIBLE
69
#define	CLOCK_BOOTTIME		CLOCK_UPTIME		/* Linux compat */
70
#define	CLOCK_REALTIME_COARSE	CLOCK_REALTIME_FAST	/* Linux compat */
71
#define	CLOCK_MONOTONIC_COARSE	CLOCK_MONOTONIC_FAST	/* Linux compat */
72
#endif
73
74
#if __BSD_VISIBLE
75
#define TIMER_RELTIME	0x0	/* relative timer */
76
#endif
77
#if __POSIX_VISIBLE >= 199506
78
#define TIMER_ABSTIME	0x1	/* absolute timer */
79
#endif /* __POSIX_VISIBLE >= 199506 */
80
81
#endif /* _SYS_SYS__CLOCK_ID_H */
(-)b/sys/sys/time.h (-27 / +1 lines)
Lines 38-43 Link Here
38
#include <sys/_timeval.h>
38
#include <sys/_timeval.h>
39
#include <sys/types.h>
39
#include <sys/types.h>
40
#include <sys/timespec.h>
40
#include <sys/timespec.h>
41
#include <sys/_clock_id.h>
41
42
42
struct timezone {
43
struct timezone {
43
	int	tz_minuteswest;	/* minutes west of Greenwich */
44
	int	tz_minuteswest;	/* minutes west of Greenwich */
Lines 471-503 struct clockinfo { Link Here
471
	int	profhz;		/* profiling clock frequency */
472
	int	profhz;		/* profiling clock frequency */
472
};
473
};
473
474
474
/* These macros are also in time.h. */
475
#ifndef CLOCK_REALTIME
476
#define	CLOCK_REALTIME	0
477
#endif
478
#ifndef CLOCK_VIRTUAL
479
#define	CLOCK_VIRTUAL	1
480
#define	CLOCK_PROF	2
481
#endif
482
#ifndef CLOCK_MONOTONIC
483
#define	CLOCK_MONOTONIC	4
484
#define	CLOCK_UPTIME	5		/* FreeBSD-specific. */
485
#define	CLOCK_UPTIME_PRECISE	7	/* FreeBSD-specific. */
486
#define	CLOCK_UPTIME_FAST	8	/* FreeBSD-specific. */
487
#define	CLOCK_REALTIME_PRECISE	9	/* FreeBSD-specific. */
488
#define	CLOCK_REALTIME_FAST	10	/* FreeBSD-specific. */
489
#define	CLOCK_MONOTONIC_PRECISE	11	/* FreeBSD-specific. */
490
#define	CLOCK_MONOTONIC_FAST	12	/* FreeBSD-specific. */
491
#define	CLOCK_SECOND	13		/* FreeBSD-specific. */
492
#define	CLOCK_THREAD_CPUTIME_ID	14
493
#define	CLOCK_PROCESS_CPUTIME_ID	15
494
#endif
495
496
#ifndef TIMER_ABSTIME
497
#define	TIMER_RELTIME	0x0	/* relative timer */
498
#define	TIMER_ABSTIME	0x1	/* absolute timer */
499
#endif
500
501
#if __BSD_VISIBLE
475
#if __BSD_VISIBLE
502
#define	CPUCLOCK_WHICH_PID	0
476
#define	CPUCLOCK_WHICH_PID	0
503
#define	CPUCLOCK_WHICH_TID	1
477
#define	CPUCLOCK_WHICH_TID	1

Return to bug 256941