// Generated by bynkc — do not edit by hand.
// commons clockwork

import { Ok, Err, Some, None, type Result, type Option, type ValidationError } from "./runtime.js";

export function horizon(now: number): number {
  return now + 3600000;
}

export function rewind(now: number): number {
  return now - 1800000;
}

export function elapsed(start: number, end: number): number {
  return end - start;
}

export function isBefore(a: number, b: number): boolean {
  return a < b;
}

export function raw(t: number): number {
  return t;
}

export function fromMillis(n: number): number {
  return n;
}

export function earliest(ts: readonly number[]): Option<number> {
  return ((__xs: readonly number[]) => { if (__xs.length === 0) return None; let __m = ((t) => t)(__xs[0]); for (const __x of __xs) { const __k = ((t) => t)(__x); if (__k < __m) __m = __k; } return Some(__m); })(ts);
}

export function chronological(ts: readonly number[]): readonly number[] {
  return [...ts].sort((__a: number, __b: number) => { const __ka = ((t) => t)(__a), __kb = ((t) => t)(__b); return __ka < __kb ? -1 : __ka > __kb ? 1 : 0; });
}

