MCPcopy Index your code
hub / github.com/coder/coder / secondsLeft

Function secondsLeft

site/src/pages/WorkspacePage/WorkspaceBuildProgress.tsx:40–46  ·  view source on GitHub ↗
(est: number)

Source from the content-addressed store, hash-verified

38): [number | undefined, string] => {
39 const sinceStart = dayjs().diff(startedAt);
40 const secondsLeft = (est: number) => {
41 const max = Math.max(
42 Math.ceil(dayjs.duration((1 - sinceStart / est) * est).asSeconds()),
43 0,
44 );
45 return Number.isNaN(max) ? 0 : max;
46 };
47
48 // Under-promise, over-deliver with the 95th percentile estimate.
49 const highGuess = secondsLeft(p95);

Callers 1

estimateFinishFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected