Files
RedBear-OS/src/header/utime/mod.rs
T
jD91mZM2 6fe3e05ea0 Delete duplicate types
Now that we use cbindgen differently :D
2018-09-02 08:17:15 +02:00

30 lines
717 B
Rust

//! utime implementation for Redox, following http://pubs.opengroup.org/onlinepubs/7908799/xsh/utime.h.html
use c_str::CStr;
use header::time::timespec;
use platform::types::*;
use platform::{Pal, Sys};
#[repr(C)]
#[derive(Clone)]
pub struct utimbuf {
pub actime: time_t,
pub modtime: time_t,
}
#[no_mangle]
pub unsafe extern "C" fn utime(filename: *const c_char, times: *const utimbuf) -> c_int {
let filename = CStr::from_ptr(filename);
let times_spec = [
timespec {
tv_sec: (*times).actime,
tv_nsec: 0,
},
timespec {
tv_sec: (*times).modtime,
tv_nsec: 0,
},
];
Sys::utimens(filename, times_spec.as_ptr())
}