MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / resolveClockSources

Function resolveClockSources

packages/agent-core/src/tools/cron/clock.ts:84–103  ·  view source on GitHub ↗
(spec?: string)

Source from the content-addressed store, hash-verified

82 * typoed bench env var would be worse than running with system time.
83 */
84export function resolveClockSources(spec?: string): ClockSources {
85 if (spec === undefined || spec === '' || spec === 'system') {
86 return SYSTEM_CLOCKS;
87 }
88
89 if (spec.startsWith('file:')) {
90 const filePath = spec.slice('file:'.length);
91 if (filePath === '') {
92 debugInvalidSpec(spec, 'empty file path');
93 return SYSTEM_CLOCKS;
94 }
95 return {
96 wallNow: () => readFileWall(filePath),
97 monoNowMs: systemMonoNowMs,
98 };
99 }
100
101 debugInvalidSpec(spec, 'unrecognised scheme');
102 return SYSTEM_CLOCKS;
103}
104
105// Epoch-ms is always under 20 characters in practice; 64 bytes leaves
106// slack for a leading newline / `\r` and prevents OOM on a hostile or

Callers 2

clock.test.tsFile · 0.90
constructorMethod · 0.90

Calls 2

debugInvalidSpecFunction · 0.85
readFileWallFunction · 0.85

Tested by

no test coverage detected