Changeset View
Changeset View
Standalone View
Standalone View
lib/libc/sys/clock_gettime.2
Show All 23 Lines | |||||
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||||
.\" SUCH DAMAGE. | .\" SUCH DAMAGE. | ||||
.\" | .\" | ||||
.\" $FreeBSD$ | .\" $FreeBSD$ | ||||
.\" | .\" | ||||
.Dd May 13, 2021 | .Dd July 1, 2021 | ||||
.Dt CLOCK_GETTIME 2 | .Dt CLOCK_GETTIME 2 | ||||
.Os | .Os | ||||
.Sh NAME | .Sh NAME | ||||
.Nm clock_gettime , | .Nm clock_gettime , | ||||
.Nm clock_settime , | .Nm clock_settime , | ||||
.Nm clock_getres | .Nm clock_getres | ||||
.Nd get/set/calibrate date and time | .Nd get/set/calibrate date and time | ||||
.Sh LIBRARY | .Sh LIBRARY | ||||
Show All 22 Lines | |||||
or | or | ||||
.Xr pthread_getcpuclockid 3 | .Xr pthread_getcpuclockid 3 | ||||
as well as the following values: | as well as the following values: | ||||
.Pp | .Pp | ||||
.Bl -tag -width indent -compact | .Bl -tag -width indent -compact | ||||
.It Dv CLOCK_REALTIME | .It Dv CLOCK_REALTIME | ||||
.It Dv CLOCK_REALTIME_PRECISE | .It Dv CLOCK_REALTIME_PRECISE | ||||
.It Dv CLOCK_REALTIME_FAST | .It Dv CLOCK_REALTIME_FAST | ||||
.It Dv CLOCK_REALTIME_COARSE | |||||
Increments as a wall clock should. | Increments as a wall clock should. | ||||
.It Dv CLOCK_MONOTONIC | .It Dv CLOCK_MONOTONIC | ||||
.It Dv CLOCK_MONOTONIC_PRECISE | .It Dv CLOCK_MONOTONIC_PRECISE | ||||
.It Dv CLOCK_MONOTONIC_FAST | .It Dv CLOCK_MONOTONIC_FAST | ||||
.It Dv CLOCK_MONOTONIC_COARSE | |||||
Increments in SI seconds. | Increments in SI seconds. | ||||
.It Dv CLOCK_UPTIME | .It Dv CLOCK_UPTIME | ||||
.It Dv CLOCK_UPTIME_PRECISE | .It Dv CLOCK_UPTIME_PRECISE | ||||
.It Dv CLOCK_UPTIME_FAST | .It Dv CLOCK_UPTIME_FAST | ||||
.It Dv CLOCK_BOOTTIME | |||||
Starts at zero when the kernel boots and increments | Starts at zero when the kernel boots and increments | ||||
monotonically in SI seconds while the machine is running. | monotonically in SI seconds while the machine is running. | ||||
.It Dv CLOCK_VIRTUAL | .It Dv CLOCK_VIRTUAL | ||||
Increments only when | Increments only when | ||||
the CPU is running in user mode on behalf of the calling process. | the CPU is running in user mode on behalf of the calling process. | ||||
.It Dv CLOCK_PROF | .It Dv CLOCK_PROF | ||||
Increments when the CPU is running in user or kernel mode. | Increments when the CPU is running in user or kernel mode. | ||||
.It Dv CLOCK_SECOND | .It Dv CLOCK_SECOND | ||||
Show All 12 Lines | |||||
are analogs of corresponding IDs without _FAST suffix but do not perform | are analogs of corresponding IDs without _FAST suffix but do not perform | ||||
a full time counter query, so their accuracy is one timer tick. | a full time counter query, so their accuracy is one timer tick. | ||||
Similarly, | Similarly, | ||||
.Fa CLOCK_REALTIME_PRECISE , | .Fa CLOCK_REALTIME_PRECISE , | ||||
.Fa CLOCK_MONOTONIC_PRECISE , | .Fa CLOCK_MONOTONIC_PRECISE , | ||||
.Fa CLOCK_UPTIME_PRECISE | .Fa CLOCK_UPTIME_PRECISE | ||||
are used to get the most exact value as possible, at the expense of | are used to get the most exact value as possible, at the expense of | ||||
execution time. | execution time. | ||||
The clock IDs | |||||
.Fa CLOCK_REALTIME_COARSE , | |||||
.Fa CLOCK_MONOTONIC_COARSE | |||||
are aliases of corresponding IDs with _FAST suffix for compatibility with other | |||||
kevans: s/wit/with/ | |||||
Done Inline ActionsChanged locally. Will update if there's other changes. imp: Changed locally. Will update if there's other changes.
| |||||
systems. | |||||
Finally, | |||||
.Dv CLOCK_BOOTTIME | |||||
is an alias for | |||||
.Dv CLOCK_UPTIME | |||||
for compatibility with other systems. | |||||
.Pp | .Pp | ||||
The structure pointed to by | The structure pointed to by | ||||
.Fa tp | .Fa tp | ||||
is defined in | is defined in | ||||
.In sys/timespec.h | .In sys/timespec.h | ||||
as: | as: | ||||
.Bd -literal | .Bd -literal | ||||
struct timespec { | struct timespec { | ||||
▲ Show 20 Lines • Show All 69 Lines • Show Last 20 Lines |
s/wit/with/