use std::{io, ptr::null};

pub fn set_real_time(seconds: u64, nanoseconds: u32) -> io::Result<()> {
    let tv = libc::timeval {
        tv_sec: seconds as _,
        tv_usec: (nanoseconds / 1000) as _,
    };
    if unsafe { libc::settimeofday(&raw const tv, null()) } != 0 {
        return Err(io::Error::last_os_error());
    }
    Ok(())
}
