oz
Which CLOCK does `Temporal` API implementation use in a deno runtime?
How is the following
typescript
line implemented in the deno
runtime to get the nano
seconds from epoch, which system CLOCK
or SYSCALL
does it use, is it possible for a deno
contributor to point me towards the (rust?) source code for the implementation?
Details:
I'm writing an extternal process that uses ffi
to integrate with a typescript
process in a deno
runtime. I want to get nanosecond-precision timestamps in my ffi
process that are consistent with the timestamps in ts
. When I use REALTIME
as the clock:
- On ubuntu
I get nano
seconds from epoch resolution, and I'm good. :check:
- On macosx
I get micro
seconds from epoch resolution, and that's a problem. :no:
Below I've read the various clocks on macosx
preceeded by their resolutions.
Notice .nsec
field in the first res
line for a clock gives the resolution in nanoseconds, and the .sec
+ .nsec
fields in the second now
line for a clock reading give the current time stamp for that clock.
Notice only REALTIME
clock has the proper time since epoch, but has it in 1000
.nsec
=> micro
second resolution so returns 000
for the last three digits of .nsec
in the reading.
The other clocks will drift from real time over time, and I may not get consistent readings in the ffi
process as in the deno
typescript process.
Question
How is the following typescript
line implemented in the deno
runtime to get the nano
seconds from epoch, which system CLOCK
or SYSCALL
does it use, is it possible for a deno
contributor to point me towards the (rust?) source code for the implementation?
2 replies