# @ircam/sc-gettime

> Unified clock in seconds between node and browser

Latest version **1.1.0** (published 2026-01-12) · BSD-3-Clause license · 0 weekly downloads

## Install

```sh
npm install @ircam/sc-gettime
pnpm add @ircam/sc-gettime
yarn add @ircam/sc-gettime
bun add @ircam/sc-gettime
```

## Health

**Score 50/100 (C)** — status: stable.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2026-01-12 |
| First published | 2022-12-07 |
| Weekly downloads | 0 |
| License | BSD-3-Clause |
| TypeScript types | none |
| Module format | ESM |
| Dependencies | 0 |
| Unpacked size | 4.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Benjamin Matuszewski |
| Maintainers | b-ma, jipodine, norbert.schnell |

## Links

- npm: https://www.npmjs.com/package/@ircam/sc-gettime
- npm.io page: https://npm.io/package/@ircam/sc-gettime

## Recent versions

- 1.1.0 (latest) — 2026-01-12
- 1.0.1 — 2023-04-19
- 1.0.0 — 2022-12-07

## README

# `@ircam/sc-gettime`

Provide a unified clock in seconds accross platforms, with an origin defined by
the start of the process.

## Install

```
npm install --save @ircam/sc-gettime
```

## Usage

The interface is the same wether you are on a node process

```js
import { getTime } from '@ircam/sc-gettime';

setInterval(() => {
  console.log(getTime());
}, 1000);
```

## Notes

- In Node.js, use `process.hrtime.bigint()` 
see: https://nodejs.org/api/process.html#processhrtimebigint 

- In browsers, use `performance.now()` if available, and falls back on `Date.now()` 
see: https://developer.mozilla.org/en-US/docs/Web/API/Performance/now 
see: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/now 

## License

BSD-3-Clause

---
_Source: https://npm.io/package/@ircam/sc-gettime · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
