feat: create branded types to determine different handling of time

This commit is contained in:
Carlos Valente
2026-02-16 06:51:43 +01:00
committed by Carlos Valente
parent 168d7103b1
commit e8f159d894
13 changed files with 315 additions and 41 deletions
-15
View File
@@ -74,18 +74,3 @@ export function timeNow() {
elapsed += now.getMilliseconds();
return elapsed;
}
/**
* Get current time from system
* @returns [number, number] - [epoch time, milliseconds since midnight]
*/
export function getTimeObject(): [number, number] {
const now = new Date();
// extract milliseconds since midnight
let elapsed = now.getHours() * 3600000;
elapsed += now.getMinutes() * 60000;
elapsed += now.getSeconds() * 1000;
elapsed += now.getMilliseconds();
return [now.getTime(), elapsed];
}