#compile-time #time-instant #const #instant #duration

no-std fugit

Time library for embedded targets with ease-of-use and performance first

12 releases

0.3.9 Nov 11, 2025
0.3.7 Jun 6, 2023
0.3.6 Jun 23, 2022
0.3.5 Feb 14, 2022
0.3.0 Nov 1, 2021

#135 in Embedded development

Download history 37840/week @ 2025-09-22 34332/week @ 2025-09-29 34563/week @ 2025-10-06 32762/week @ 2025-10-13 32296/week @ 2025-10-20 31441/week @ 2025-10-27 33733/week @ 2025-11-03 34970/week @ 2025-11-10 36190/week @ 2025-11-17 31801/week @ 2025-11-24 39713/week @ 2025-12-01 40667/week @ 2025-12-08 45423/week @ 2025-12-15 29415/week @ 2025-12-22 24486/week @ 2025-12-29 40035/week @ 2026-01-05

143,267 downloads per month
Used in 353 crates (133 directly)

MIT/Apache

150KB
2.5K SLoC

fugit

fugit provides a comprehensive library of Duration and Instant for the handling of time in embedded systems, doing all it can at compile time.

This library is a heavily inspired of std::chrono's Duration from C++ which does all it can at compile time.

Aims

  • no_std library with goals of user-friendliness and performance first
    • All methods are const fn that can be (i.e. non-trait methods)
    • Use no traits, concrete types all the way for maximum const-ification
    • Operations are supported between different bases and backing storages instead of implementing custom traits
    • All constants needed for comparing or changing timebase are guaranteed compile time generated
  • Support for both u32 and u64 backing storage with efficient instruction lowering on MCUs
    • On Cortex-M3 and up: no soft-impls pulled in for both u32 and u64 except when changing base on u64
    • Comparisons on u32 and u64 do not use division, only changing base with all constants calculated at compile time
  • Selection of base happens at compile time
    • A common problem is that run time changing of base robs us of a lot of optimization opportunities, but since there are no traits and short-hands select the correct base at compile time.

Dependencies

~11–285KB