fugit
Time library for embedded targets with ease-of-use and performance first.
0.5.0
5.4M downloads/mo
#4373 most downloaded on crates.io
korken89/fugit
What this package is like to depend on
Last release 8 days ago
15 Aug 2026
Ships unpredictably
gaps range from 2 weeks to 2.4 years
Rarely documented
notes for 2 of 14 stable releases
5 versions withdrawn
withdrawn after publishing
5 years old
19 releases · first in 2021
4 releases in the last 12 months
see the full history below
Release timeline
19 releases · Oct 2021 to Aug 2026Releases
latest 19-
0.5.015 Aug 2026Release notes
Open source →Added
- The
Monotonicinstant kind (together with the oldWrappingkind), for timelines that do not wrap. Before, theInstantstarted to get methods that were related toMonotonicinstants - this is now split. MonotonicInstant,MonotonicTimerInstant,MonotonicTimerInstantU32andMonotonicTimerInstantU64aliases.Instant::is_beforeandInstant::is_after, wrap-aware onWrapping, a plain tick compare onMonotonic.Instantnow implementsHash.Instant'sDebugoutput names the kind:WrappingInstant { ticks: 7 }.
Fixed
- Issue #84:
Instantcomparison no longer reportsEqualfor instants that are not equal. - Cross-base operations on
u32storage truncated theiru64conversion constants, panicking with a divide-by-zero or returning silently wrong results.
Breaking Changes
- BREAKING: Operations between time bases differing by more than the storage type's maximum are
now a compile-time error. Only
u32storage with a base ratio aboveu32::MAXis affected. - BREAKING: Issue #83: wrapping instants are no longer
Ord, that compare is not transitive.PartialOrdis kept, so<,>,<=and>=are unaffected. Monotonic instants areOrd. - BREAKING: Issue #84: on wrapping instants
const_cmpis replaced byconst_partial_cmp, which returnsNonefor instants exactly half the tick range apart. Monotonic instants keepconst_cmp, where a total order makes it sound. - BREAKING: Rename
checked_sub_durationtoconvert_sub_durationandchecked_add_durationtoconvert_add_durationwith improved docs. - BREAKING:
Instanttakes a fourth type parameter naming its timeline kind.Instant<u32, 1, 1_000>becomesWrappingInstant<u32, 1, 1_000>, orInstant<u32, 1, 1_000, kind::Wrapping>. - BREAKING: The
TimerInstant,TimerInstantU32andTimerInstantU64aliases are replaced byWrappingTimerInstant,WrappingTimerInstantU32andWrappingTimerInstantU64. - BREAKING:
duration_since_epochis removed from wrapping instants, where a fixed epoch is meaningless. UseDuration::from_ticks(i.as_ticks())for the old ticks-to-Durationshorthand.
- The
-
0.4.006 May 2026Release notes
Open source →Added
Duration::ZEROandDuration::MAXconstantsDuration::checked_mul,checked_div,div_ceilmethodsDuration::saturating_add,saturating_sub,saturating_mulmethodsDuration::from_secs_f32andfrom_secs_f64constructors with roundingDuration::as_secs_f32andas_secs_f64conversions- Support for picosecond-level precision (enabled by u64 const generics)
picos()shorthand method toExtU32,ExtU64,ExtU32Ceil, andExtU64CeiltraitsDuration::from_picos,as_picos,from_picos_at_leastmethodsPicosDuration<T>,PicosDurationU32,PicosDurationU64aliasesGigahertz<T>,GigahertzU32,GigahertzU64aliases (thedefmt/Displayimpls already formatted this base asGHz)core::ops::Remandcore::ops::RemAssigntrait implementations forRateandDuration(fixes #41)core::ops::SubAssignforRate(was missing; asymmetric withAdd/AddAssign/Sub)- Conversion to/from
core::time::Duration
Fixed
- Issue #50: Rate conversions now use half-up rounding instead of truncating for better accuracy
- Issue #53: Overflow detection in shorthand conversions (e.g.,
NanosDurationU32.minutes()) - Added
#[track_caller]to all panicking functions and operator impls (including*Assignwrappers,Mul/Div/Remon integers, and the cross-typeu32<->u64ops) so panic locations point at the user's call site. - Documentation clarifications across
Instant::checked_*_duration,Instant::checked_duration_since,Duration::checked_*/Rate::checked_*, thetry_from_*/try_to_*conversions, and theconst_partial_cmp/const_eqmethods. Several methods previously claimed to "check for overflow" or "check for divide-by-zero" while the actual contract was different (e.g. wrapping ticks, returningNoneon cross-base conversion overflow). Duration::const_try_from/const_try_into/convert(and the same onRate) no longer overflowu64silently when ticks are close tou64::MAX. The rounding step(lh + d/2) / dwas replaced with an overflow-free divmod-based form that produces the same rounded result without ever wrapping.Duration::Hz/kHz/MHz,Rate::Hz/kHz/MHz,Rate::to_Hz/to_kHz/to_MHz,Duration::try_from_rate, andRate::try_from_durationnow produce a compile-time error when the conversion constants don't fit the storage type, instead of silently truncatingu64constants on au32cast.- The
Durationshorthand methods (as_*,from_*,from_*_at_least) and theRate::Hz/kHz/MHz/to_Hz/to_kHz/to_MHzfamily now panic on multiplication overflow instead of silently wrapping in release builds. All gained#[track_caller]so the panic points at the user's call site.
Changed
- Modernized CI
- Updated
gcddependency to 2.3 - Updated
defmtdependency to 1.0
Breaking Changes
- BREAKING:
Duration::const_try_fromnow rounds-to-nearest, before it was truncating - BREAKING: Standardized API naming conventions
- Constructors now use
from_*prefix (e.g.,from_ticks,from_rate) - Getters now use
to_*oras_*prefix (e.g.,to_rate,as_ticks)
- Constructors now use
- BREAKING: Changed
NOMandDENOMconst generic parameters fromu32tou64across all types (Duration,Rate,Instant)- This enables support for higher precision time units (e.g., picoseconds with denominator 1_000_000_000_000)
- Type aliases with
FREQ_HZparameters now useu64instead ofu32 - Compile-time calculations use u128 intermediates with overflow checks, but results are guaranteed to fit in u64 for embedded compatibility
-
0.3.911 Nov 2025Nothing published for this version
-
0.3.811 Nov 2025 withdrawnRelease notes
Open source →Added
- Optional
serdesupport - Optional
postcardmax size support
Fixed
Changed
- Optional
-
0.3.706 Jun 2023Nothing published for this version
-
0.3.623 Jun 2022Nothing published for this version
-
0.3.514 Feb 2022Nothing published for this version
-
0.3.414 Feb 2022 withdrawnRelease notes
Open source →Added
- Add
Divimplementation forDurationandRate - Add
nanos()methods andNanosDurationaliases alongside other units. - Implement AddAssign and SubAssign for Instant and Duration, and MulAssign and DivAssign for Duration.
- Add
to_nanos(),to_micros(),to_millis(),to_secs(),to_minutes(), andto_hours()methods toDuration<u32, NOM, DENOM>andDuration<u64, NOM, DENOM>types to easily convert to integer time units. - Support for
Rate(Hertz, Kilohertz, ...)
Fixed
Changed
- Add
-
0.3.325 Dec 2021Nothing published for this version
-
0.3.219 Dec 2021Nothing published for this version
-
0.3.113 Dec 2021 withdrawnNothing published for this version
-
0.3.001 Nov 2021 withdrawnNothing published for this version
-
0.2.131 Oct 2021Nothing published for this version
-
0.2.031 Oct 2021 withdrawnNothing published for this version
-
0.1.431 Oct 2021Nothing published for this version
-
0.1.331 Oct 2021Nothing published for this version
-
0.1.231 Oct 2021Nothing published for this version
-
0.1.129 Oct 2021Nothing published for this version
-
0.1.028 Oct 2021Nothing published for this version