0.8.2 - 2023-09-22
Instant.clock_name
is back and now tracksclock_id
using reflection.- Explicit minimum Ruby version in gemspec (2.7.0).
-
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
0.8.1 - 2023-09-18
- After further consideration, return to defaulting to
CLOCK_MONOTONIC
instead of the overly-elaborate auto-selection introduced in 0.8.0.
Instant.clock_name
. No I'm not incrementing to 0.9. It's been a few hours, you're not using it, shut up.
0.8.0 - 2023-09-17
- 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.
- 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.
- CI on TruffleRuby has been fixed by disabling SimpleCov.
- Several fragile tests depending on relatively narrow sleep times have been fixed.
- @petergoldstein for fixing CI on TruffleRuby and adding 3.1 and 3.2.
- @fig for fixing a README error.
0.7.1 - 2021-10-22
simplecov
introduced to test suite.monotime/include.rb
to auto-include types globally.
- All
Instant
andDuration
instances are now frozen. - Migrate from Travis CI to Github Actions
- Update development dependency on
rake
.
0.7.0 - 2019-04-24
Duration.with_measure
, which yields and returns an array containing its evaluated return value and itsDuration
.
- 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).
0.6.1 - 2018-10-26
- Build gem from a clean git checkout, not my local development directory. No functional changes.
0.6.0 - 2018-10-26
- This
CHANGELOG.md
by request of @celsworth. - Aliases for
Duration.from_*
andDuration#to_*
without the prefix. e.g.Duration.from_secs(42).to_secs == 42
can now be written asDuration.secs(42).secs == 42
. Duration#nonzero?
.Instant#in_past?
andInstant#in_future?
.
0.5.0 - 2018-10-13
Duration#abs
to make aDuration
positive.Duration#-@
to invert the sign of aDuration
.Duration#positive?
Duration#negative?
Duration#zero?
Instant#sleep
with no argument now sleeps until theInstant
.Duration.from_*
no longer coerce their argument toFloat
.Duration#==
checks value via#to_nanos
, not type.Duration#eql?
checks value and type.Duration#<=>
compares value via#to_nanos
.
0.4.0 - 2018-10-09
Instant#sleep
- sleep to a givenDuration
past anInstant
.Instant#sleep_secs
andInstant#sleep_millis
convenience methods.Duration#sleep
- sleep for theDuration
.Duration#*
- multiply aDuration
by a number.Duration#/
- divide aDuration
by a number.
More #to_nanos
Duration
duck-typing.
0.3.0 - 2018-10-04
#to_nanos
is now used to duck-typeDuration
everywhere.
- Make
<=>
return nil on invalid types, rather than raising aTypeError
.
- Dependency on
dry-equalizer
.
0.2.0 - 2018-10-03
Instant#to_s
as an alias for#elapsed.to_s
Duration#to_nanos
, with some limited duck-typing.
- Switch to microseconds internally.
Duration#to_{secs,millis,micros}
now return aFloat
.Instant#ns
is nowprotected
.
Duration#to_s
zero-stripping with precision=0.Instant#-
argument ordering with otherInstant
.Duration#to_micros
returns microseconds, not picoseconds.
Instant
andDuration
maths methods no longer support passing anInteger
number of nanoseconds.
0.1.0 - 2018-10-02
- Initial release