Skip to content

Commit

Permalink
Auto merge of #3152 - shua:mactime, r=JohnTitor
Browse files Browse the repository at this point in the history
mac time.h functions

I used these in https://github.com/shua/graf because I'm used to them, and don't really want to pull in time or chrono just for some stuff already present in libc.h . Compilation worked fine on my linux target, but failed on mac osx because these weren't defined in rust-lang/libc (but these are all present in 13.1 SDK).
  • Loading branch information
bors committed Mar 29, 2023
2 parents a7c13b9 + 78244fe commit 21d90af
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
7 changes: 7 additions & 0 deletions libc-test/semver/apple.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1819,6 +1819,8 @@ arc4random
arc4random_buf
arc4random_uniform
arphdr
asctime
asctime_r
attrgroup_t
attribute_set_t
attrlist
Expand All @@ -1845,6 +1847,8 @@ copyfile
copyfile_flags_t
cpu_subtype_t
cpu_type_t
ctime
ctime_r
ctl_info
difftime
dirfd
Expand Down Expand Up @@ -1880,6 +1884,7 @@ futimes
getattrlist
getattrlistat
getattrlistbulk
getdate
getdomainname
getdtablesize
getfsstat
Expand Down Expand Up @@ -2181,8 +2186,10 @@ stack_t
statfs
strcasecmp
strcasestr
strftime
strncasecmp
strndup
strptime
strsignal
strtonum
sync
Expand Down
17 changes: 17 additions & 0 deletions src/unix/bsd/apple/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5121,6 +5121,23 @@ extern "C" {
pub fn endutxent();
pub fn utmpxname(file: *const ::c_char) -> ::c_int;

pub fn asctime(tm: *const ::tm) -> *mut ::c_char;
pub fn ctime(clock: *const time_t) -> *mut ::c_char;
pub fn getdate(datestr: *const ::c_char) -> *mut ::tm;
pub fn strftime(
buf: *mut ::c_char,
maxsize: ::size_t,
format: *const ::c_char,
timeptr: *const ::tm,
) -> ::size_t;
pub fn strptime(
buf: *const ::c_char,
format: *const ::c_char,
timeptr: *mut ::tm,
) -> *mut ::c_char;
pub fn asctime_r(tm: *const ::tm, result: *mut ::c_char) -> *mut ::c_char;
pub fn ctime_r(clock: *const time_t, result: *mut ::c_char) -> *mut ::c_char;

pub fn getnameinfo(
sa: *const ::sockaddr,
salen: ::socklen_t,
Expand Down

0 comments on commit 21d90af

Please sign in to comment.