MCPcopy Index your code
hub / github.com/tinyplex/tinybase / getTimeFunctions

Function getTimeFunctions

test/unit/common/mergeable.ts:39–53  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

37const START_TIME = new Date('2024-01-01 00:00:00 UTC').valueOf();
38
39export const getTimeFunctions = (): [
40 reset: () => void,
41 getNow: () => number,
42 pause: (ms?: number) => Promise<void>,
43] => {
44 let time = 0;
45 return [
46 () => (time = START_TIME),
47 () => time,
48 async (ms = 50): Promise<void> => {
49 time += ms;
50 return pause(ms);
51 },
52 ];
53};
54
55export const time = (offset: number, counter: number, storeId: string = 's1') =>
56 encodeHlc(START_TIME + offset, counter, STORE_ID_HASHES[storeId]);

Calls 1

pauseFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…