mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-14 20:03:52 +00:00
feat: create branded types to determine different handling of time
This commit is contained in:
committed by
Carlos Valente
parent
168d7103b1
commit
e8f159d894
@@ -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];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user