TimeCore#
Summary#
This PR proposes the creation of a TimeCore abstract class to serve as the foundational core for managing time-related functionalities. This class can be extended to create specific components such as timers, stopwatches, alarm clocks, and clocks. The TimeCore class leverages the Temporal API for precise time management and supports updating the current time at regular intervals.
Motivation#
The motivation behind this RFC is to provide a flexible and efficient core for time-related components, enabling consistent and simplified management of time functionalities. By creating an abstract TimeCore class, we ensure a robust foundation that can be extended to various use cases, such as timers, stopwatches, and clocks, while maintaining consistent behavior and time management practices.
Parameters#
timeZone?: Temporal.TimeZoneLike
An optional parameter that specifies the time zone to use for the current time. Defaults to the system's time zone.
###Methods
getCurrentTime(): Temporal.ZonedDateTime
Returns the current time.
setTimeZone(timeZone: Temporal.TimeZoneLike): void
Sets a new time zone and updates the current time accordingly.
startUpdatingTime(intervalMs?: number): void
Starts updating the current time at the specified interval in milliseconds.
stopUpdatingTime(): void
Stops updating the current time.