Skip to content

Commit

Permalink
some time functions on glibc and musl
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveLauC committed Oct 12, 2022
1 parent 88b2ed2 commit bfc4064
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 2 deletions.
6 changes: 5 additions & 1 deletion libc-test/semver/linux-gnu.txt
Expand Up @@ -653,4 +653,8 @@ utmpname
utmpx
utmpxname
euidaccess
eaccess
eaccess
asctime_r
ctime_r
strftime
strptime
5 changes: 4 additions & 1 deletion libc-test/semver/linux-musl.txt
Expand Up @@ -49,4 +49,7 @@ pwritev64
reallocarray
timex
euidaccess
eaccess
eaccess
asctime_r
strftime
strptime
11 changes: 11 additions & 0 deletions src/unix/linux_like/linux/gnu/mod.rs
Expand Up @@ -1335,6 +1335,17 @@ extern "C" {

pub fn euidaccess(pathname: *const ::c_char, mode: ::c_int) -> ::c_int;
pub fn eaccess(pathname: *const ::c_char, mode: ::c_int) -> ::c_int;

pub fn asctime_r(tm: *const ::tm, buf: *mut ::c_char) -> *mut ::c_char;
pub fn ctime_r(timep: *const time_t, buf: *mut ::c_char) -> *mut ::c_char;

pub fn strftime(
s: *mut ::c_char,
max: ::size_t,
format: *const ::c_char,
tm: *const ::tm,
) -> ::size_t;
pub fn strptime(s: *const ::c_char, format: *const ::c_char, tm: *mut ::tm) -> *mut ::c_char;
}

extern "C" {
Expand Down
10 changes: 10 additions & 0 deletions src/unix/linux_like/linux/musl/mod.rs
Expand Up @@ -757,6 +757,16 @@ extern "C" {

pub fn euidaccess(pathname: *const ::c_char, mode: ::c_int) -> ::c_int;
pub fn eaccess(pathname: *const ::c_char, mode: ::c_int) -> ::c_int;

pub fn asctime_r(tm: *const ::tm, buf: *mut ::c_char) -> *mut ::c_char;

pub fn strftime(
s: *mut ::c_char,
max: ::size_t,
format: *const ::c_char,
tm: *const ::tm,
) -> ::size_t;
pub fn strptime(s: *const ::c_char, format: *const ::c_char, tm: *mut ::tm) -> *mut ::c_char;
}

cfg_if! {
Expand Down

0 comments on commit bfc4064

Please sign in to comment.