UNPKG

@toreda/time

Version:

Simple, small footprint library for common time operations and converting between units of time.

18 lines (17 loc) 567 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.timeNow = void 0; const defaults_1 = require("../defaults"); const make_1 = require("./make"); /** * Create timestamp using current time at creation. Does not automatically * update to match * @param units * @returns */ function timeNow(units) { const targetUnits = units !== null && units !== void 0 ? units : 's'; const now = Math.floor(Date.now() / defaults_1.Defaults.Time.MsPerSec); return (0, make_1.timeMake)(targetUnits, now); } exports.timeNow = timeNow;