Skip to content

Commit

Permalink
Better comments for code
Browse files Browse the repository at this point in the history
Signed-off-by: Prathamesh Mutkure <pmutkure009@gmail.com>
  • Loading branch information
prathamesh-mutkure committed Sep 22, 2023
1 parent 8cf1047 commit 044d35e
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions packages/jaeger-ui/src/utils/date.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ const YESTERDAY = 'Yesterday';
export const STANDARD_DATE_FORMAT = 'YYYY-MM-DD';
export const STANDARD_TIME_FORMAT = 'HH:mm';
export const STANDARD_DATETIME_FORMAT = 'MMMM D YYYY, HH:mm:ss.SSS';
export const ONE_MILLISECOND = 1000;
export const ONE_MICROSECOND = 1;
export const ONE_MILLISECOND = 1000 * ONE_MICROSECOND;
export const ONE_SECOND = 1000 * ONE_MILLISECOND;
export const ONE_MINUTE = 60 * ONE_SECOND;
export const ONE_HOUR = 60 * ONE_MINUTE;
Expand Down Expand Up @@ -71,7 +72,7 @@ const quantizeDuration = (duration: number, floatPrecision: number, conversionFa
toFloatPrecision(duration / conversionFactor, floatPrecision) * conversionFactor;

/**
* @param {number} duration - number of microseconds elapsed since midnight, January 1, 1970 Universal Coordinated Time (UTC).
* @param {number} duration - Unix Time
* @return {string} formatted, unit-labelled string with time in milliseconds
*
* @example
Expand All @@ -84,7 +85,7 @@ export function formatDate(duration: number): string {
}

/**
* @param {number} duration - number of microseconds elapsed since midnight, January 1, 1970 Universal Coordinated Time (UTC).
* @param {number} duration - Unix Time
* @return {string} formatted, unit-labelled string with time in milliseconds
*
* @example
Expand All @@ -97,7 +98,7 @@ export function formatTime(duration: number): string {
}

/**
* @param {number} duration - number of microseconds elapsed since midnight, January 1, 1970 Universal Coordinated Time (UTC).
* @param {number} duration - Unix Time
* @return {string} formatted, unit-labelled string with time in milliseconds
*
* @example
Expand All @@ -110,7 +111,7 @@ export function formatDatetime(duration: number): string {
}

/**
* @param {number} duration - number of microseconds elapsed since midnight, January 1, 1970 Universal Coordinated Time (UTC).
* @param {number} duration - Unix Time
* @return {string} formatted, unit-labelled string with time in milliseconds
*
* @example
Expand All @@ -125,7 +126,7 @@ export function formatMillisecondTime(duration: number): string {
}

/**
* @param {number} duration - number of microseconds elapsed since midnight, January 1, 1970 Universal Coordinated Time (UTC).
* @param {number} duration - Unix Time
* @return {string} formatted, unit-labelled string with time in seconds
*
* @example
Expand All @@ -142,12 +143,12 @@ export function formatSecondTime(duration: number): string {
/**
* Humanizes the duration for display.
*
* Example:
* @example
* 5000ms => 5s
* 1000μs => 1ms
* 183840s => 2d 3h
*
* @param {number} duration - number of microseconds elapsed since midnight, January 1, 1970 Universal Coordinated Time (UTC).
* @param {number} duration - Unix Time
* @return {string} formatted duration
*/
export function formatDuration(duration: number): string {
Expand Down

0 comments on commit 044d35e

Please sign in to comment.