MCPcopy
hub / github.com/Effect-TS/effect / nextSecond

Function nextSecond

packages/effect/src/internal/schedule.ts:1686–1697  ·  view source on GitHub ↗
(now: number, second: number, initial: boolean)

Source from the content-addressed store, hash-verified

1684
1685/** @internal */
1686export const nextSecond = (now: number, second: number, initial: boolean): number => {
1687 const date = new Date(now)
1688 if (date.getSeconds() === second && initial) {
1689 return now
1690 }
1691 if (date.getSeconds() < second) {
1692 return date.setSeconds(second)
1693 }
1694 // Set seconds to the provided value and add one minute
1695 const newDate = new Date(date.setSeconds(second))
1696 return newDate.setTime(newDate.getTime() + 1000 * 60)
1697}
1698
1699// -----------------------------------------------------------------------------
1700// Minutes

Callers 1

secondOfMinuteFunction · 0.85

Calls 1

setTimeMethod · 0.65

Tested by

no test coverage detected