Skip to content

Releases: Freaky/monotime

Clock auto-selection redux

22 Sep 19:09
Compare
Choose a tag to compare

Added

  • Instant.clock_name is back and now tracks clock_id using reflection.
  • Explicit minimum Ruby version in gemspec (2.7.0).

Changed

  • Clock auto-selection redux. We choose the first available from:

    1. CLOCK_UPTIME_RAW on macOS, faster and higher resolution, also used by Rust
    2. CLOCK_MONOTONIC
    3. 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

18 Sep 03:22
Compare
Choose a tag to compare

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

17 Sep 22:18
Compare
Choose a tag to compare

Added

  • Default precision for Duration#to_s can be set using Duration.default_to_s_precision=.
  • Default sleep function can be set using Duration.sleep_function=
  • Duration::ZERO and Duration.zero for an easy, memory-efficient zero-duration singleton.
  • Instant.clock_id and Instant.clock_id= to control the default clock source.
  • Instant.clock_getres to get the minimum supported Duration 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

22 Oct 15:52
Compare
Choose a tag to compare

0.7.1 - 2021-10-22

Added

  • simplecov introduced to test suite.
  • monotime/include.rb to auto-include types globally.

Changed

  • All Instant and Duration instances are now frozen.
  • Migrate from Travis CI to Github Actions
  • Update development dependency on rake.

A measured change

24 Apr 23:00
Compare
Choose a tag to compare

Added

  • Duration.with_measure, which yields and returns an array containing its
    evaluated return value and its Duration.

Changed

  • Break Duration and Instant into their own files.
  • Rename Monotime::VERSION to Monotime::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

26 Oct 16:23
Compare
Choose a tag to compare

Make the gem from a clean git checkout, not my local development directory.

No functional changes, other than simplecov on tests.

Aliases and conveniences

26 Oct 02:32
Compare
Choose a tag to compare
  • Add CHANGELOG.md
  • Aliases for Duration.from_* and Duration#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? and Instant#in_future?, plus aliases without the in_.

Instant sleep, if only

13 Oct 12:04
Compare
Choose a tag to compare
  • Instant#sleep with no arguments sleeps until the given Instant
  • Add Duration#abs and Duration#-@
  • Duration.from_* no longer coerce to Float
  • Documentation improvements

Sleepy maths

08 Oct 23:04
Compare
Choose a tag to compare
  • Add Duration#* and #/
  • Add Instant#sleep and Duration#sleep
  • Improve Duration duck typing via #to_nanos

Fewer deps, better docs

04 Oct 01:25
Compare
Choose a tag to compare
  • Remove dependency on dry-equalizer
  • Duck type Duration around #to_nanos where appropriate
  • Fix <=> handling with invalid types
  • Improve API documentation