UNPKG

908 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.epochMillisFromMillisSince2001_01_01 = epochMillisFromMillisSince2001_01_01;
4exports.epochMillisFromMillisSince2001_01_01Buffer = epochMillisFromMillisSince2001_01_01Buffer;
5const tslib_1 = require("tslib");
6const assert_1 = tslib_1.__importDefault(require("assert"));
7const tlv_1 = require("./tlv");
8const EPOCH_MILLIS_2001_01_01 = Date.UTC(2001, 0, 1, 0, 0, 0, 0);
9/**
10 * @group Utils
11 */
12function epochMillisFromMillisSince2001_01_01(millis) {
13 return EPOCH_MILLIS_2001_01_01 + millis;
14}
15/**
16 * @group Utils
17 */
18function epochMillisFromMillisSince2001_01_01Buffer(millis) {
19 (0, assert_1.default)(millis.length === 8, "can only parse 64 bit buffers!");
20 const millisSince2001 = (0, tlv_1.readUInt64LE)(millis);
21 return epochMillisFromMillisSince2001_01_01(millisSince2001);
22}
23//# sourceMappingURL=time.js.map
\No newline at end of file