Compare commits

...

1 Commits

Author SHA1 Message Date
Jarred Sumner
e6af5d6d16 Add uv_hrtime() 2024-10-22 16:57:26 -07:00
4 changed files with 23 additions and 0 deletions

View File

@@ -12,4 +12,22 @@ uv_pid_t uv_os_getppid()
return getppid();
}
#if OS(LINUX)
#include <time.h>
uint64_t uv_hrtime()
{
timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
return ts.tv_sec * 1000000000ULL + ts.tv_nsec;
}
#elif OS(DARWIN)
#include <mach/mach_time.h>
uint64_t uv_hrtime()
{
return mach_absolute_time();
}
#endif
#endif

View File

@@ -12,4 +12,7 @@ extern "C" BUN_EXPORT uv_pid_t uv_os_getpid();
// Returns the parent process ID.
extern "C" BUN_EXPORT uv_pid_t uv_os_getppid();
// Returns the current high-resolution time in nanoseconds.
extern "C" BUN_EXPORT uint64_t uv_hrtime();
#endif

View File

@@ -6,6 +6,7 @@ BUN_1.1 {
uv_os_getpid;
uv_os_getppid;
uv_hrtime;
extern "C++" {
v8::*;

View File

@@ -216,3 +216,4 @@ __ZNK2v88Function7GetNameEv
__ZNK2v85Value10IsFunctionEv
_uv_os_getpid
_uv_os_getppid
_uv_hrtime