devela::_dep::nc

Function clock_settime

pub unsafe fn clock_settime(
    which_clock: i32,
    tp: &timespec_t,
) -> Result<(), i32> 
Available on crate feature dep_nc only.
Expand description

Set time of specific clock.

§Examples

let mut tp = nc::timespec_t::default();
let ret = unsafe { nc::clock_gettime(nc::CLOCK_REALTIME, &mut tp) };
assert!(ret.is_ok());
assert!(tp.tv_sec > 0);
let ret = unsafe { nc::clock_settime(nc::CLOCK_REALTIME, &tp) };
assert!(ret.is_err());
assert_eq!(ret, Err(nc::EPERM));