/
fleisar
/
agent-timetracker
Обзор
Документация
Войти
/
fleisar
/
agent-timetracker
Код
Запросы
0
Задачи
Вики
Пакеты
1
Релизы
2
CI/CD
Аналитика
Безопасность
main
src/util/clock.ts
23 строки
504 B
Matvey Kuznetsov
feat: add tracker domain types
02 июл 2026, 18:27
02 июл 2026, 18:27
bf8255d
Код
Авторство
О чём код?
import { formatIsoTimestamp, parseIsoTimestamp } from "./time.js"; export interface Clock { now(): string; } export class SystemClock implements Clock { now(): string { return new Date().toISOString(); } } export class FixedClock implements Clock { private readonly current: string; constructor(now: string | Date) { this.current = typeof now === "string" ? formatIsoTimestamp(parseIsoTimestamp(now)) : formatIsoTimestamp(now); } now(): string { return this.current; } }