Skip to content

Add more windows time.h functions #4427

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions libc-test/semver/windows.txt
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,15 @@ c_void
calloc
chdir
chmod
clock
clock_t
close
commit
connect
creat
ctime
dev_t
difftime
dup
dup2
errno_t
Expand Down Expand Up @@ -214,7 +217,11 @@ fsetpos
fstat
ftell
fwrite
get_daylight
get_dstbias
get_osfhandle
get_timezone
get_tzname
getchar
getcwd
getenv
Expand Down Expand Up @@ -326,6 +333,7 @@ tm
tmpfile
tolower
toupper
tzset
uint16_t
uint32_t
uint64_t
Expand Down
13 changes: 13 additions & 0 deletions src/windows/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -374,12 +374,25 @@ extern "C" {
pub fn signal(signum: c_int, handler: sighandler_t) -> sighandler_t;
pub fn raise(signum: c_int) -> c_int;

pub fn clock() -> clock_t;
pub fn ctime(sourceTime: *const time_t) -> *mut c_char;
pub fn difftime(timeEnd: time_t, timeStart: time_t) -> c_double;
#[link_name = "_gmtime64_s"]
pub fn gmtime_s(destTime: *mut tm, srcTime: *const time_t) -> c_int;
#[link_name = "_get_daylight"]
pub fn get_daylight(hours: *mut c_int) -> errno_t;
#[link_name = "_get_dstbias"]
pub fn get_dstbias(seconds: *mut c_long) -> errno_t;
#[link_name = "_get_timezone"]
pub fn get_timezone(seconds: *mut c_long) -> errno_t;
#[link_name = "_get_tzname"]
pub fn get_tzname(p_return_value: *mut size_t, time_zone_name: *mut c_char, size_in_bytes: size_t, index: c_int) -> errno_t;
#[link_name = "_localtime64_s"]
pub fn localtime_s(tmDest: *mut tm, sourceTime: *const time_t) -> crate::errno_t;
#[link_name = "_time64"]
pub fn time(destTime: *mut time_t) -> time_t;
#[link_name = "_tzset"]
pub fn tzset();
#[link_name = "_chmod"]
pub fn chmod(path: *const c_char, mode: c_int) -> c_int;
#[link_name = "_wchmod"]
Expand Down
Loading