UNPKG

@opentelemetry/core

Version:

OpenTelemetry Core provides constants and utilities shared by all OpenTelemetry SDK packages.

66 lines • 2.09 kB
import * as api from "@opentelemetry/api"; //#region src/common/time.d.ts /** * Converts a number of milliseconds from epoch to HrTime([seconds, remainder in nanoseconds]). * @param epochMillis */ declare function millisToHrTime(epochMillis: number): api.HrTime; /** * Returns an hrtime calculated via performance component. * @param performanceNow */ declare function hrTime(performanceNow?: number): api.HrTime; /** * * Converts a TimeInput to an HrTime, defaults to _hrtime(). * @param time */ declare function timeInputToHrTime(time: api.TimeInput): api.HrTime; /** * Returns a duration of two hrTime. * @param startTime * @param endTime */ declare function hrTimeDuration(startTime: api.HrTime, endTime: api.HrTime): api.HrTime; /** * Convert hrTime to timestamp, for example "2019-05-14T17:00:00.000123456Z" * @param time */ declare function hrTimeToTimeStamp(time: api.HrTime): string; /** * Convert hrTime to nanoseconds. * @param time */ declare function hrTimeToNanoseconds(time: api.HrTime): number; /** * Convert hrTime to microseconds. * @param time */ declare function hrTimeToMicroseconds(time: api.HrTime): number; /** * Convert hrTime to milliseconds. * @param time */ declare function hrTimeToMilliseconds(time: api.HrTime): number; /** * Convert hrTime to seconds. * @param time */ declare function hrTimeToSeconds(time: api.HrTime): number; /** * check if time is HrTime * @param value */ declare function isTimeInputHrTime(value: unknown): value is api.HrTime; /** * check if input value is a correct types.TimeInput * @param value */ declare function isTimeInput(value: unknown): value is api.HrTime | number | Date; /** * Given 2 HrTime formatted times, return their sum as an HrTime. */ declare function addHrTimes(time1: api.HrTime, time2: api.HrTime): api.HrTime; //#endregion export { addHrTimes, hrTime, hrTimeDuration, hrTimeToMicroseconds, hrTimeToMilliseconds, hrTimeToNanoseconds, hrTimeToSeconds, hrTimeToTimeStamp, isTimeInput, isTimeInputHrTime, millisToHrTime, timeInputToHrTime }; //# sourceMappingURL=time.d.mts.map