Skip to content

Commit 4ebf0e3

Browse files
WIP: Convert timestamp to hrtime
1 parent 1912f63 commit 4ebf0e3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/services/VirtualMachineService.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { WASI } from '@wasmer/wasi/lib';
22
import WASIBindings from '@wasmer/wasi/lib/bindings/node';
33
import { WasmFs } from '@wasmer/wasmfs';
4+
import Big from 'big.js';
45
import { alea } from 'seedrandom';
56
import { VmContext } from "../models/Context";
67
import { ExecuteResult } from '../models/ExecuteResult';
@@ -21,7 +22,7 @@ export function executeWasm(context: VmContext): Promise<ExecuteResult> {
2122
bindings: {
2223
...WASIBindings,
2324
fs: virtualFs.getFs(),
24-
hrtime: () => BigInt(context.timestamp),
25+
hrtime: () => BigInt(new Big(context.timestamp).mul(1_000_000).toString()),
2526
randomFillSync: (buffer: any, offset, size) => {
2627
const randomBuffer = generateFixedBuffer(random.int32().toString(), size ?? buffer.length - offset);
2728
buffer.set(randomBuffer, offset);

0 commit comments

Comments
 (0)