Within a javascript k6 project, the following line fails
const now = process.hrtime.bigint();
Error: ReferenceError: process is not defined\n\tat file:///tmp/socket-test.js:63:19(93)\n\tat github.com/loadimpact/k6/js/common.Bind.func1 (native)\n\tat _default (file:///tmp/socket-test.js:42:33(50))\n" executor=ramping-vus scenario=default source=stacktrace
What’s the recommended way of accessing nanosecond time via k6 if not via process?
The best you can do with the built-in JS modules is millisecond precision with e.g. Date.now().
As k6 is built with Go, which uses nanosecond precision, it should be fairly trivial to expose this via the new xk6 extension system. See this tutorial for a quick introduction.