@sagentic-ai/sagentic-af / Timing
Timing ​
Timing holds start and end time.
Constructors ​
new Timing(start, end) ​
new Timing(start?, end?): Timing
Creates a new Timing object. If start
and end
are provided, end
must be after start
.
Parameters ​
• start?: Moment
optional start time, defaults to now
• end?: Moment
optional end time, defaults to undefined
Returns ​
Throws ​
Error if end is before start
Source ​
Properties ​
_end? ​
private optional _end: Moment;
Source ​
_start ​
private _start: Moment;
Source ​
Accessors ​
elapsed ​
get elapsed(): Duration
Returns the elapsed time. If the timing has not ended, returns the time elapsed since start.
Returns ​
Duration
the elapsed time
Source ​
end ​
get end(): undefined | Moment
Returns the end time, or undefined if the timing has not ended
Returns ​
undefined
| Moment
Source ​
hasEnded ​
get hasEnded(): boolean
Returns true if the timing has ended
Returns ​
boolean
Source ​
start ​
get start(): Moment
Returns the start time
Returns ​
Moment
Source ​
Methods ​
finish() ​
finish(): void
Finishes the timing with current time. If already finished or started in the future, throws an error.
Returns ​
void
Throws ​
Error if timing has already ended or when it started in the future