@technobuddha/library
Version:
A large library of useful functions
119 lines (118 loc) • 2.98 kB
TypeScript
/**
* Store and manipulate a duration of time
* @group Time
* @category Time Span
*/
export declare class TimeSpan {
/**
* Create a new TimeSpan
*/
constructor();
/**
* Create a new TimeSpan from ticks (milliseconds)
* @param ticks - the number of ticks (milliseconds)
*/
constructor(ticks: number);
/**
* Create a new TimeSpan from hours, minutes, and seconds
* @param h - Hours
* @param m - minutes
* @param s - seconds
*/
constructor(h: number, m: number, s: number);
/**
* Create a new TimeSpan from days, hours, minutes, and seconds
* @param d - Days
* @param h - Hours
* @param m - minutes
* @param s - seconds
*/
constructor(d: number, h: number, m: number, s: number);
/**
* Create a new TimeSpan from days, hours, minutes, seconds, and milliseconds
* @param d - Days
* @param h - Hours
* @param m - minutes
* @param s - seconds
* @param ms - milliseconds
*/
constructor(d: number, h: number, m: number, s: number, ms: number);
/**
* Create a new TimeSpan from a formatted string
* @param text - formatted timespan (dd:hh:mm:ss.fff) leading zero fields can be omitted
*/
constructor(text: string);
private readonly clicks;
/**
* Get the days portion
*/
get days(): number;
/**
* Get the hours portion
*/
get hours(): number;
/**
* Get the minutes portion
*/
get minutes(): number;
/**
* Get the seconds portion
*/
get seconds(): number;
/**
* Get the milliseconds portion
*/
get milliseconds(): number;
/**
* Get the total number of ticks (milliseconds)
*/
get ticks(): number;
/**
* Get the total number of days
*/
get totalDays(): number;
/**
* Get the total number of hours
*/
get totalHours(): number;
/**
* Get the total number of minutes
*/
get totalMinutes(): number;
/**
* Get the total number of seconds
*/
get totalSeconds(): number;
/**
* Get the total number of milliseconds
*/
get totalMilliseconds(): number;
/**
* Format the timespan using a mask
*
* @param mask - The mask
* @returns the formatted TimeSpan
*/
format(mask?: string): string;
/**
* Convert the TimeSpan to a string
*
* @returns formatted string
*/
toString(): string;
/**
* Add two timespans
*
* @param other - TimeSpan to add to this
* @returns a TimeSpan that is the sum of two timespans
*/
add(other: TimeSpan): TimeSpan;
/**
* Compare two TimeSpans
*
* @param t1 - First TimeSpan
* @param t2 - Second TimeSpan
* @returns -1 if the first time span is less then the second, 0 if they are equal, 1 if the first is greater
*/
static compare(t1: TimeSpan, t2: TimeSpan): number;
}