chrisimcevoy / pyoda-time

A better date and time API for Python
https://pyodatime.org/
Apache License 2.0
1 stars 0 forks source link

feat: `IClock`, `SystemClock` & `ZonedClock` #162

Closed chrisimcevoy closed 1 month ago

chrisimcevoy commented 1 month ago

The SystemClock implementation here uses time.time_ns(), so is operating at a finer resolution (nanoseconds) than Noda Time's implementation which uses DateTime.UtcNow.Ticks. Not that it probably makes any difference; I could well see the relatively slow execution of pure python code eating up the duration of 1 tick in the real world.

This also moves /tests/testing into /pyoda_time/testing. Because the NodaTime.Testing library is public, and we (like Noda Time) advertise FakeClock as a thing that people might use. Rather than releasing a separate package, we'll just include it as a sub-package in the main project.

codecov[bot] commented 1 month ago

Codecov Report

Attention: Patch coverage is 88.25758% with 31 lines in your changes missing coverage. Please review.

Project coverage is 95.47%. Comparing base (0c5b142) to head (15072e0).

Files Patch % Lines
pyoda_time/testing/_fake_clock.py 60.34% 23 Missing :warning:
pyoda_time/_i_clock.py 80.95% 4 Missing :warning:
pyoda_time/time_zones/_date_time_zone_cache.py 66.66% 2 Missing :warning:
pyoda_time/_i_date_time_zone_provider.py 75.00% 1 Missing :warning:
pyoda_time/time_zones/_i_date_time_zone_source.py 75.00% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #162 +/- ## ========================================== - Coverage 95.55% 95.47% -0.09% ========================================== Files 248 257 +9 Lines 19309 19560 +251 ========================================== + Hits 18451 18675 +224 - Misses 858 885 +27 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.