#time #duration #instant #const

no-std fugit

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

10 releases

Uses new Rust 2021

0.3.3 Dec 25, 2021
0.3.2 Dec 19, 2021
0.3.0 Nov 1, 2021
0.2.1 Oct 31, 2021
0.1.4 Oct 31, 2021

#172 in Embedded development

Download history 27/week @ 2021-10-23 227/week @ 2021-10-30 817/week @ 2021-11-06 1634/week @ 2021-11-13 243/week @ 2021-11-20 858/week @ 2021-11-27 1030/week @ 2021-12-04 968/week @ 2021-12-11 850/week @ 2021-12-18 2193/week @ 2021-12-25 681/week @ 2022-01-01 1184/week @ 2022-01-08 1048/week @ 2022-01-15

5,180 downloads per month
Used in 18 crates (10 directly)

MIT/Apache

77KB
1.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

~155KB

Ia