app/@overflow/core/now.ts
crusader a9f514b9fb ing
2018-08-16 19:49:37 +09:00

12 lines
363 B
TypeScript

/**
* Get the time from some arbitrary fixed starting point. The time will not be
* based on clock time.
*
* Ideally we'd just use `performance.now` but that's a browser API and not
* available in our Plain Old Node main process environment.
*/
export function now(): number {
const time = process.hrtime();
return time[0] * 1000 + time[1] / 1000000;
}