'L i$ .dZddlmZddlZddlmZddlmZddlmZddlmZddlmZdd l m Z e rdd l m Z ejd Gd dZejd GddZejGddZgdZy)zIndirection for time functions. We intentionally grab some "time" functions internally to avoid tests mocking "time" to affect pytest runtime information (issue #185). Fixture "mock_timing" also interacts with this module for pytest's own tests. ) annotationsN)datetime)timezone perf_counter)sleeptime) TYPE_CHECKING) MonkeyPatchT)frozenceZdZUdZej ddZded<ej ddZded<d d Z d d Z y )Instantz Represents an instant in time, used to both get the timestamp value and to measure the duration of a time span. Inspired by Rust's `std::time::Instant`. ctSNr T/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/_pytest/timing.pyzInstant.#sDFrF)default_factoryinitfloatr ctSrrrrrrzInstant.(s r perf_countc,t|tS)z1Measure the duration since `Instant` was created.)startstop)Durationrselfs relapsedzInstant.elapsed+sd33rc^tj|jtjS)zInstant as UTC datetime.)r fromtimestampr rutcrs ras_utczInstant.as_utc/s%%dii>>rN)returnr)r&r) __name__ __module__ __qualname____doc__ dataclassesfieldr __annotations__rr!r%rrrrrsL$+##NOD%O* )).UJ4?rrc8eZdZUdZded<ded<eddZy)rz2A span of time as measured by `Instant.elapsed()`.rrrc\|jj|jjz S)zaElapsed time of the duration in seconds, measured using a performance counter for precise timing.)rrrrs rsecondszDuration.seconds;s#yy##djj&;&;;;rNr&r)r'r(r)r*r-propertyr0rrrrr4s!< N M <rN)r0rr&Noner1)rBr r&rD) r'r(r)r*r timestampr:r-rr rCrrrr4r4As; _$D!RR<FFHM5H&"?rr4)rrr )r* __future__rr+rrr rrtypingr pytestr dataclassrrr4__all__rrrrKs# "d#??$?6d# < <$ < ???: ,r