embedded-time icon indicating copy to clipboard operation
embedded-time copied to clipboard

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

Open seanybaggins opened this issue 3 years ago • 4 comments

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?

seanybaggins avatar Apr 15 '21 14:04 seanybaggins

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?

PTaylor-us avatar Aug 29 '21 14:08 PTaylor-us

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

eldruin avatar Aug 29 '21 15:08 eldruin

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

PTaylor-us avatar Aug 29 '21 15:08 PTaylor-us

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

eldruin avatar Aug 29 '21 15:08 eldruin