"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Timestamp = exports.LongWithoutOverridesClass = void 0; const long_1 = require("./long"); /** @public */ exports.LongWithoutOverridesClass = long_1.Long; /** @public */ class Timestamp extends exports.LongWithoutOverridesClass { constructor(low, high) { if (long_1.Long.isLong(low)) { super(low.low, low.high, true); } else { super(low, high, true); } Object.defineProperty(this, '_bsontype', { value: 'Timestamp', writable: false, configurable: false, enumerable: false }); } toJSON() { return { $timestamp: this.toString() }; } /** Returns a Timestamp represented by the given (32-bit) integer value. */ static fromInt(value) { return new Timestamp(long_1.Long.fromInt(value, true)); } /** Returns a Timestamp representing the given number value, provided that it is a finite number. Otherwise, zero is returned. */ static fromNumber(value) { return new Timestamp(long_1.Long.fromNumber(value, true)); } /** * Returns a Timestamp for the given high and low bits. Each is assumed to use 32 bits. * * @param lowBits - the low 32-bits. * @param highBits - the high 32-bits. */ static fromBits(lowBits, highBits) { return new Timestamp(lowBits, highBits); } /** * Returns a Timestamp from the given string, optionally using the given radix. * * @param str - the textual representation of the Timestamp. * @param optRadix - the radix in which the text is written. */ static fromString(str, optRadix) { return new Timestamp(long_1.Long.fromString(str, true, optRadix)); } /** @internal */ toExtendedJSON() { return { $timestamp: { t: this.high >>> 0, i: this.low >>> 0 } }; } /** @internal */ static fromExtendedJSON(doc) { return new Timestamp(doc.$timestamp.i, doc.$timestamp.t); } /** @internal */ [Symbol.for('nodejs.util.inspect.custom')]() { return this.inspect(); } inspect() { return `Timestamp(${this.getLowBits().toString()}, ${this.getHighBits().toString()})`; } } exports.Timestamp = Timestamp; Timestamp.MAX_VALUE = long_1.Long.MAX_UNSIGNED_VALUE; //# sourceMappingURL=timestamp.js.map