import { Temporal } from "@js-temporal/polyfill"; export const now = Temporal.Now; export const printTime = (duration: Temporal.Duration): string => { const units = [ { unit: "m", value: duration.minutes }, { unit: "s", value: duration.seconds }, { unit: "ms", value: duration.milliseconds }, { unit: "µs", value: duration.microseconds }, { unit: "ns", value: duration.nanoseconds }, ]; const parts = units .filter((u) => u.value !== 0) .map((u) => `${u.value} ${u.unit}`); return parts.join(", "); }; export const toNum = (v: string) => { return parseInt(v, 10); };