Skip to content
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

deps: update to uvwasi 0.0.15 #46253

Merged
merged 1 commit into from
Jan 20, 2023
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
2 changes: 1 addition & 1 deletion deps/uvwasi/include/uvwasi.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ extern "C" {

#define UVWASI_VERSION_MAJOR 0
#define UVWASI_VERSION_MINOR 0
#define UVWASI_VERSION_PATCH 14
#define UVWASI_VERSION_PATCH 15
#define UVWASI_VERSION_HEX ((UVWASI_VERSION_MAJOR << 16) | \
(UVWASI_VERSION_MINOR << 8) | \
(UVWASI_VERSION_PATCH))
Expand Down
33 changes: 9 additions & 24 deletions deps/uvwasi/src/clocks.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,38 +11,23 @@
#include "uv_mapping.h"


#define UVWASI__WIN_TIME_AND_RETURN(handle, time) \
#define UVWASI__WIN_TIME_AND_RETURN(handle, get_times, time) \
do { \
FILETIME create; \
FILETIME exit; \
FILETIME system; \
FILETIME user; \
SYSTEMTIME sys_system; \
SYSTEMTIME sys_user; \
if (0 == GetProcessTimes((handle), &create, &exit, &system, &user)) { \
if (0 == get_times((handle), &create, &exit, &system, &user)) { \
return uvwasi__translate_uv_error( \
uv_translate_sys_error(GetLastError()) \
); \
} \
\
if (0 == FileTimeToSystemTime(&system, &sys_system)) { \
return uvwasi__translate_uv_error( \
uv_translate_sys_error(GetLastError()) \
); \
} \
\
if (0 == FileTimeToSystemTime(&user, &sys_user)) { \
return uvwasi__translate_uv_error( \
uv_translate_sys_error(GetLastError()) \
); \
} \
\
(time) = (((uvwasi_timestamp_t)(sys_system.wHour * 3600) + \
(sys_system.wMinute * 60) + sys_system.wSecond) * NANOS_PER_SEC) + \
((uvwasi_timestamp_t)(sys_system.wMilliseconds) * 1000000) + \
(((uvwasi_timestamp_t)(sys_user.wHour * 3600) + \
(sys_user.wMinute * 60) + sys_user.wSecond) * NANOS_PER_SEC) + \
((uvwasi_timestamp_t)(sys_user.wMilliseconds) * 1000000); \
/* FILETIME times are in units of 100 nanoseconds */ \
(time) = (((uvwasi_timestamp_t) \
system.dwHighDateTime << 32 | system.dwLowDateTime) * 100 + \
((uvwasi_timestamp_t) \
user.dwHighDateTime << 32 | user.dwLowDateTime) * 100); \
return UVWASI_ESUCCESS; \
} while (0)

Expand Down Expand Up @@ -137,7 +122,7 @@ uvwasi_errno_t uvwasi__clock_gettime_realtime(uvwasi_timestamp_t* time) {

uvwasi_errno_t uvwasi__clock_gettime_process_cputime(uvwasi_timestamp_t* time) {
#if defined(_WIN32)
UVWASI__WIN_TIME_AND_RETURN(GetCurrentProcess(), *time);
UVWASI__WIN_TIME_AND_RETURN(GetCurrentProcess(), GetProcessTimes, *time);
#elif defined(CLOCK_PROCESS_CPUTIME_ID) && \
!defined(__APPLE__) && \
!defined(__sun)
Expand All @@ -150,7 +135,7 @@ uvwasi_errno_t uvwasi__clock_gettime_process_cputime(uvwasi_timestamp_t* time) {

uvwasi_errno_t uvwasi__clock_gettime_thread_cputime(uvwasi_timestamp_t* time) {
#if defined(_WIN32)
UVWASI__WIN_TIME_AND_RETURN(GetCurrentThread(), *time);
UVWASI__WIN_TIME_AND_RETURN(GetCurrentThread(), GetThreadTimes, *time);
#elif defined(__APPLE__)
UVWASI__OSX_THREADTIME_AND_RETURN(*time);
#elif defined(CLOCK_THREAD_CPUTIME_ID) && !defined(__sun) && !defined(__PASE__)
Expand Down