1 | /**
|
2 | * Copyright 2018, OpenCensus Authors
|
3 | *
|
4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | * you may not use this file except in compliance with the License.
|
6 | * You may obtain a copy of the License at
|
7 | *
|
8 | * http://www.apache.org/licenses/LICENSE-2.0
|
9 | *
|
10 | * Unless required by applicable law or agreed to in writing, software
|
11 | * distributed under the License is distributed on an "AS IS" BASIS,
|
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13 | * See the License for the specific language governing permissions and
|
14 | * limitations under the License.
|
15 | */
|
16 | /**
|
17 | * The Clock class is used to record the duration and endTime for spans.
|
18 | */
|
19 | export declare class Clock {
|
20 | /** Indicates if the clock is endend. */
|
21 | private endedLocal;
|
22 | /** Indicates the clock's start time. */
|
23 | private startTimeLocal;
|
24 | /** The time in high resolution in a [seconds, nanoseconds]. */
|
25 | private hrtimeLocal;
|
26 | /** The duration between start and end of the clock. */
|
27 | private diff;
|
28 | /** Constructs a new Clock instance. */
|
29 | constructor(startTime?: Date);
|
30 | /** Ends the clock. */
|
31 | end(): void;
|
32 | /** Gets the current date from ellapsed milliseconds and start time. */
|
33 | readonly currentDate: Date;
|
34 | /** Gets the duration of the clock. */
|
35 | readonly duration: number;
|
36 | /** Starts the clock. */
|
37 | readonly startTime: Date;
|
38 | /**
|
39 | * Gets the time so far.
|
40 | * @returns A Date object with the current duration.
|
41 | */
|
42 | readonly endTime: Date;
|
43 | /** Indicates if the clock was ended. */
|
44 | readonly ended: boolean;
|
45 | }
|