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 11, 2022
1 parent 88b2ed2 commit 9e0e943
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 2 deletions.
8 changes: 7 additions & 1 deletion libc-test/semver/linux-gnu.txt
Expand Up @@ -653,4 +653,10 @@ utmpname
utmpx
utmpxname
euidaccess
eaccess
eaccess
asctime
asctime_r
ctime
ctime_r
strftime
strptime
6 changes: 5 additions & 1 deletion libc-test/semver/linux-musl.txt
Expand Up @@ -49,4 +49,8 @@ pwritev64
reallocarray
timex
euidaccess
eaccess
eaccess
asctime
asctime_r
strftime
strptime
13 changes: 13 additions & 0 deletions src/unix/linux_like/linux/gnu/mod.rs
Expand Up @@ -1335,6 +1335,19 @@ 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(tm: *const ::tm) -> *mut ::c_char;
pub fn asctime_r(tm: *const ::tm, buf: *mut ::c_char) -> *mut ::c_char;
pub fn ctime(timep: *const time_t) -> *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
11 changes: 11 additions & 0 deletions src/unix/linux_like/linux/musl/mod.rs
Expand Up @@ -757,6 +757,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(tm: *const ::tm) -> *mut ::c_char;
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 9e0e943

Please sign in to comment.