TVTOHZ(9) | Kernel Developer's Manual | TVTOHZ(9)

# NAME

`tvtohz`, `tstohz` — translate time period to timeout delay

# SYNOPSIS

`#include <sys/types.h>`
`#include <sys/time.h>`
`#include <sys/systm.h>`

int
`tvtohz`(const struct timeval *tv);

int
`tstohz`(const struct timespec *ts);

# DESCRIPTION

The `tvtohz`() and `tstohz`() functions return the number of ticks in the specified amount of time. If the return value would exceed the maximum value representable by an int, it is capped at `INT_MAX`. They are mainly used to translate a timeval or timespec, respectively, into a suitable argument for tsleep(9).

# CODE REFERENCES

These functions are implemented in the file sys/kern/kern_clock.c.

# SEE ALSO

hz(9), timeout(9)

January 18, 2019 | Debian