Releases: Freaky/monotime
Releases · Freaky/monotime
Clock auto-selection redux
Added
Instant.clock_name
is back and now tracksclock_id
using reflection.- Explicit minimum Ruby version in gemspec (2.7.0).
Changed
-
Clock auto-selection redux. We choose the first available from:
CLOCK_UPTIME_RAW
on macOS, faster and higher resolution, also used by RustCLOCK_MONOTONIC
CLOCK_REALTIME
, a non-monotonic fallback that issues a warning on startup
-
Slight performance bump for
Duration.measure
on Ruby <= 3.1
Reversion to the monotonic
0.8.1 - 2023-09-18
Changed
- After further consideration, return to defaulting to
CLOCK_MONOTONIC
instead of the overly-elaborate auto-selection introduced in 0.8.0.
Removed
Instant.clock_name
. No I'm not incrementing to 0.9. It's been a few hours, you're not using it, shut up.
Configurable clocks, switchable sleeps
Added
- Default precision for
Duration#to_s
can be set usingDuration.default_to_s_precision=
. - Default sleep function can be set using
Duration.sleep_function=
Duration::ZERO
andDuration.zero
for an easy, memory-efficient zero-duration singleton.Instant.clock_id
andInstant.clock_id=
to control the default clock source.Instant.clock_getres
to get the minimum supportedDuration
from the selected clock source.Instant.monotonic_function=
to completely replace the default monotonic function.
Changed
- The default clock source is now chosen from a selection of options instead of defaulting to
CLOCK_MONOTONIC
. Where possible options are used which are unaffected by NTP frequency skew and which do not count time in system suspend. - CI matrix drops Ruby 2.5 and 2.6 and adds 3.1, 3.2, head branches of Ruby, JRuby, and TruffleRuby, and also tests under macOS.
Fixed
- CI on TruffleRuby has been fixed by disabling SimpleCov.
- Several fragile tests depending on relatively narrow sleep times have been fixed.
Thanks
- @petergoldstein for fixing CI on TruffleRuby and adding 3.1 and 3.2.
- @fig for fixing a README error.
Frozen times
0.7.1 - 2021-10-22
Added
simplecov
introduced to test suite.monotime/include.rb
to auto-include types globally.
Changed
- All
Instant
andDuration
instances are now frozen. - Migrate from Travis CI to Github Actions
- Update development dependency on
rake
.
A measured change
Added
Duration.with_measure
, which yields and returns an array containing its
evaluated return value and itsDuration
.
Changed
- Break
Duration
andInstant
into their own files. - Rename
Monotime::VERSION
toMonotime::MONOTIME_VERSION
to reduce
potential for collision if the module is included. - Update to bundler 2.0.
- Rework README.md. Includes fix for issue #1 (added a "See Also" section).
I know what I'm doing, honest
Make the gem from a clean git checkout, not my local development directory.
No functional changes, other than simplecov on tests.
Aliases and conveniences
- Add
CHANGELOG.md
- Aliases for
Duration.from_*
andDuration#to_*
without the prefix. e.g.
Duration.from_secs(42).to_secs == 42
can now be written as
Duration.secs(42).secs == 42
. Duration#nonzero?
.Instant#in_past?
andInstant#in_future?
, plus aliases without thein_
.
Instant sleep, if only
Instant#sleep
with no arguments sleeps until the given Instant- Add
Duration#abs
andDuration#-@
Duration.from_*
no longer coerce toFloat
- Documentation improvements
Sleepy maths
- Add
Duration#*
and#/
- Add
Instant#sleep
andDuration#sleep
- Improve
Duration
duck typing via#to_nanos
Fewer deps, better docs
- Remove dependency on dry-equalizer
- Duck type
Duration
around#to_nanos
where appropriate - Fix <=> handling with invalid types
- Improve API documentation