![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@thi.ng/timestamp
Advanced tools
Timestamp getter wrapping (in order of preference) `process.hrtime.bigint()`, `performance.now()` or `Date.now()`
[!NOTE] This is one of 201 standalone projects, maintained as part of the @thi.ng/umbrella monorepo and anti-framework.
🚀 Please help me to work full-time on these projects by sponsoring me on GitHub. Thank you! ❤️
Timestamp getter wrapping (in order of preference) process.hrtime.bigint()
, performance.now()
or Date.now()
.
[!NOTE] The functions in this package have been extracted from @thi.ng/bench.
This package provides the following functions:
now()
attempts
to use high-res ES
BigInt
timestamps (in Node via
process.hrtime.bigint()
),
or falls back to performance.now()
, or lacking that, uses Date.now()
. In all
cases, returns a (possibly rounded) nanosec-scale timestamp, either as bigint
or number
.timeDiff()
function can be used to compute the difference between two such timestamp and
return it as milliseconds.asMillis()
takes a duration (either a number or bigint) in nanosec-scale and converts it
to a JS number in millisecondsSTABLE - used in production
Search or submit any issues for this package
yarn add @thi.ng/timestamp
ESM import:
import * as tim from "@thi.ng/timestamp";
Browser ESM import:
<script type="module" src="https://esm.run/@thi.ng/timestamp"></script>
For Node.js REPL:
const tim = await import("@thi.ng/timestamp");
Package sizes (brotli'd, pre-treeshake): ESM: 214 bytes
None
TODO
If this project contributes to an academic publication, please cite it as:
@misc{thing-timestamp,
title = "@thi.ng/timestamp",
author = "Karsten Schmidt",
note = "https://thi.ng/timestamp",
year = 2018
}
© 2018 - 2025 Karsten Schmidt // Apache License 2.0
FAQs
Timestamp getter wrapping (in order of preference) `process.hrtime.bigint()`, `performance.now()` or `Date.now()`
The npm package @thi.ng/timestamp receives a total of 1,224 weekly downloads. As such, @thi.ng/timestamp popularity was classified as popular.
We found that @thi.ng/timestamp demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.