@@ -31,16 +31,16 @@ class Instant:
3131 """
3232
3333 # Creation time of this instant, using time.time(), to measure actual time.
34- # Use a `lambda` to initialize the default to correctly get the mocked time via `MockTiming`.
34+ # Note: using a `lambda` to correctly get the mocked time via `MockTiming`.
3535 time : float = dataclasses .field (default_factory = lambda : time (), init = False )
3636
3737 # Performance counter tick of the instant, used to measure precise elapsed time.
38- # Use a `lambda` to initialize the default to correctly get the mocked time via `MockTiming`.
38+ # Note: using a `lambda` to correctly get the mocked time via `MockTiming`.
3939 perf_count : float = dataclasses .field (
4040 default_factory = lambda : perf_counter (), init = False
4141 )
4242
43- def duration (self ) -> Duration :
43+ def elapsed (self ) -> Duration :
4444 """Measure the duration since `Instant` was created."""
4545 return Duration (start = self , stop = Instant ())
4646
@@ -57,8 +57,8 @@ class Duration:
5757 stop : Instant
5858
5959 @property
60- def elapsed_s (self ) -> float :
61- """Elapsed time of the duration, in seconds, measured using a performance counter for precise timing."""
60+ def seconds (self ) -> float :
61+ """Elapsed time of the duration in seconds, measured using a performance counter for precise timing."""
6262 return self .stop .perf_count - self .start .perf_count
6363
6464
0 commit comments