Skip to content

Version 2.0.0

Latest

Choose a tag to compare

@naingaunglwin-dev naingaunglwin-dev released this 10 May 21:03
5d4ed64

v2.0.0 - 2026-05-11

Added

  • Added Result::value() and Result::unit() to access the raw calculated value and current unit separately from formatted output.
  • Added Result::toArray() for structured result output with raw time, unit, and optional formatted values.

Changed

  • Changed Result::format() from positional placeholders like %s %s / %s%s to named placeholders like {time} and {unit} for clearer, more extensible formatting templates.
  • Updated Result to keep the raw calculated value separate from the selected format template. Result::get() still returns the rendered string when a format is set, while the raw value remains available through Result::value().
  • Changed TimeTracker::watch() to return the callback result in result and the execution time as a Result instance in time.

Fixed

  • Fixed formatted TimeTracker::durations() output by preserving the immutable Result returned from Result::format().
  • Updated callback error formatting in TimeTracker::watch() to use the named {time} and {unit} placeholders.

Breaking Changes

  • Existing format templates that use %s placeholders must be updated to use {time} and {unit} instead.
  • The Result constructor now expects the calculated value to be raw float|int|null; formatted strings should be produced through Result::format().
  • TimeTracker::watch() no longer returns separate unit and output keys. Use time for the Result instance and result for the callback return value.