🔄 Big News! bazed.ai is now sagentic.ai. Same vision, new name!

Skip to content

@sagentic-ai/sagentic-af / Timing

Timing ​

Timing holds start and end time.

Constructors ​

new Timing(start, end) ​

ts
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 ​

Timing

Throws ​

Error if end is before start

Source ​

src/common.ts:36

Properties ​

_end? ​

ts
private optional _end: Moment;

Source ​

src/common.ts:29


_start ​

ts
private _start: Moment;

Source ​

src/common.ts:28

Accessors ​

elapsed ​

ts
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 ​

src/common.ts:67


end ​

ts
get end(): undefined | Moment

Returns the end time, or undefined if the timing has not ended

Returns ​

undefined | Moment

Source ​

src/common.ts:81


hasEnded ​

ts
get hasEnded(): boolean

Returns true if the timing has ended

Returns ​

boolean

Source ​

src/common.ts:60


start ​

ts
get start(): Moment

Returns the start time

Returns ​

Moment

Source ​

src/common.ts:76

Methods ​

finish() ​

ts
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

Source ​

src/common.ts:50