use crate::fd::{AsFd, OwnedFd};
use crate::timespec::Timespec;
use crate::{backend, io};
pub use backend::time::types::{TimerfdClockId, TimerfdFlags, TimerfdTimerFlags};
#[derive(Debug, Clone)]
pub struct Itimerspec {
pub it_interval: Timespec,
pub it_value: Timespec,
}
#[inline]
pub fn timerfd_create(clockid: TimerfdClockId, flags: TimerfdFlags) -> io::Result<OwnedFd> {
backend::time::syscalls::timerfd_create(clockid, flags)
}
#[inline]
pub fn timerfd_settime<Fd: AsFd>(
fd: Fd,
flags: TimerfdTimerFlags,
new_value: &Itimerspec,
) -> io::Result<Itimerspec> {
backend::time::syscalls::timerfd_settime(fd.as_fd(), flags, new_value)
}
#[inline]
pub fn timerfd_gettime<Fd: AsFd>(fd: Fd) -> io::Result<Itimerspec> {
backend::time::syscalls::timerfd_gettime(fd.as_fd())
}