MCPcopy Index your code
hub / github.com/triggerdotdev/trigger.dev / ClockAPI

Class ClockAPI

packages/core/src/v3/clock/index.ts:9–37  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7const SIMPLE_CLOCK = new SimpleClock();
8
9export class ClockAPI {
10 private static _instance?: ClockAPI;
11
12 private constructor() {}
13
14 public static getInstance(): ClockAPI {
15 if (!this._instance) {
16 this._instance = new ClockAPI();
17 }
18
19 return this._instance;
20 }
21
22 public setGlobalClock(clock: Clock): boolean {
23 return registerGlobal(API_NAME, clock);
24 }
25
26 public preciseNow(): ClockTime {
27 return this.#getClock().preciseNow();
28 }
29
30 public reset(): void {
31 this.#getClock().reset();
32 }
33
34 #getClock(): Clock {
35 return getGlobal(API_NAME) ?? SIMPLE_CLOCK;
36 }
37}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…