Skip to content
This repository has been archived by the owner on Jul 16, 2024. It is now read-only.

Commit

Permalink
fix: Adding nowMs function
Browse files Browse the repository at this point in the history
  • Loading branch information
lightwalker-eth committed Apr 1, 2024
1 parent 12da5c9 commit 1659be7
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/time.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,22 @@ export const msToSeconds = (ms: bigint): bigint => {
return ms / 1000n;
};

/**
* Retrieves the current time in millisceonds.
* @returns bigint - The current timestamp in millisceonds.
*/
export const nowMs = (): bigint => {
// Returns the current time in milliseconds as a BigInt
return BigInt(Date.now());
};

/**
* Retrieves the current time in seconds.
* @returns bigint - The current timestamp in seconds.
*/
export const now = (): bigint => {
// Returns the current time in seconds as a BigInt
return msToSeconds(BigInt(Date.now()));
return msToSeconds(nowMs());
};

const shortDateFormat = "d MMM yyyy";
Expand Down

0 comments on commit 1659be7

Please sign in to comment.