FluenTech / embedded-time

Time(ing) library (Instant/Duration/Clock/Timer/Period/Frequency) for bare-metal embedded systems
Apache License 2.0
87 stars 17 forks source link

Should the try_now method in the Clock trait take a &mut self instead of &self? #99

Open seanybaggins opened 3 years ago

seanybaggins commented 3 years ago

It would be nice if try_now would update the internal state of the clock before attempting to return the time. As it currently stands, it is up to the user of the clock to make sure it is updated before they attempt to call try_now. Thoughts?

PTaylor-us commented 2 years ago

Sorry for the ridiculously long delay in responding. I'm really hoping to get back into a pattern of working on this crate.

In my implementations, I have been reading directly from hardware which doesn't necessitate changing the internal state of the Clock object. Do you have an implementation that would require that?

eldruin commented 2 years ago

Here is some relevant discussion about this: https://github.com/FluenTech/embedded-time/issues/32

PTaylor-us commented 2 years ago

@eldruin Thanks for the reminder. It's been awhile.

eldruin commented 2 years ago

You are welcome Peter! nice to see you again :)