aboutsummaryrefslogtreecommitdiff
path: root/embassy-time/src
diff options
context:
space:
mode:
authorAndres O. Vela <[email protected]>2024-05-30 22:16:56 +0200
committerAndres O. Vela <[email protected]>2024-05-30 22:16:56 +0200
commit6eaa25934226ee5ff2038a34e6d32b5d69559c1d (patch)
treeb732407ca438eaae2b017c5a107c499f81539853 /embassy-time/src
parent694ac3a51573421c90e350c6253e2f42b4ab0bb1 (diff)
embassy-time: add timestamp features
Diffstat (limited to 'embassy-time/src')
-rw-r--r--embassy-time/src/lib.rs17
1 files changed, 16 insertions, 1 deletions
diff --git a/embassy-time/src/lib.rs b/embassy-time/src/lib.rs
index 3c8575ee9..24ee51be7 100644
--- a/embassy-time/src/lib.rs
+++ b/embassy-time/src/lib.rs
@@ -46,5 +46,20 @@ pub(crate) const GCD_1K: u64 = gcd(TICK_HZ, 1_000);
46pub(crate) const GCD_1M: u64 = gcd(TICK_HZ, 1_000_000); 46pub(crate) const GCD_1M: u64 = gcd(TICK_HZ, 1_000_000);
47pub(crate) const GCD_1G: u64 = gcd(TICK_HZ, 1_000_000_000); 47pub(crate) const GCD_1G: u64 = gcd(TICK_HZ, 1_000_000_000);
48 48
49#[cfg(feature = "defmt-timestamp-uptime")] 49#[cfg(feature = "defmt-timestamp-uptime-s")]
50defmt::timestamp! {"{=u64}", Instant::now().as_secs() }
51
52#[cfg(feature = "defmt-timestamp-uptime-ms")]
53defmt::timestamp! {"{=u64:ms}", Instant::now().as_millis() }
54
55#[cfg(any(feature = "defmt-timestamp-uptime", feature = "defmt-timestamp-uptime-us"))]
50defmt::timestamp! {"{=u64:us}", Instant::now().as_micros() } 56defmt::timestamp! {"{=u64:us}", Instant::now().as_micros() }
57
58#[cfg(feature = "defmt-timestamp-uptime-ts")]
59defmt::timestamp! {"{=u64:ts}", Instant::now().as_secs() }
60
61#[cfg(feature = "defmt-timestamp-uptime-tms")]
62defmt::timestamp! {"{=u64:tms}", Instant::now().as_millis() }
63
64#[cfg(feature = "defmt-timestamp-uptime-tus")]
65defmt::timestamp! {"{=u64:tus}", Instant::now().as_micros() }