2020-03-09 15:18:02 +01:00
|
|
|
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
2020-07-07 04:45:39 +03:00
|
|
|
|
2020-03-09 15:18:02 +01:00
|
|
|
import { sendSync, sendAsync } from "./dispatch_json.ts";
|
|
|
|
|
2020-07-07 04:45:39 +03:00
|
|
|
interface NowResponse {
|
|
|
|
seconds: number;
|
|
|
|
subsecNanos: number;
|
|
|
|
}
|
|
|
|
|
2020-03-09 15:18:02 +01:00
|
|
|
export function stopGlobalTimer(): void {
|
|
|
|
sendSync("op_global_timer_stop");
|
|
|
|
}
|
|
|
|
|
|
|
|
export async function startGlobalTimer(timeout: number): Promise<void> {
|
|
|
|
await sendAsync("op_global_timer", { timeout });
|
|
|
|
}
|
2020-03-10 00:22:15 +01:00
|
|
|
|
|
|
|
export function now(): NowResponse {
|
|
|
|
return sendSync("op_now");
|
|
|
|
}
|