Time structure for microseconds #90
-
I am trying to print time based on local, also print microseconds. Something like this: Now with time.h and some standard C functions I can do this:
And the print: I have looked at the API, and you have focused on TZ and seconds of time, which I get. Now my question is simple, is there any way to get a structure with microseconds in your API? Or is there a fundamental issue? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Storing microseconds requires storing an extra 32-bit integer in various classes. On 8-bit AVR processors, |
Beta Was this translation helpful? Give feedback.
-
In my opinion, I think it helps to distinguish 2 different concepts of a "clock":
Some languages and environments provide a good separation of these 2 concepts (e.g. C++, Java, to some extent Python). Some environments conflate the 2 concepts more than I would like (e.g. C, Unix, Golang). In the microcontrollers world, the term "clock" is a bit overloaded, often referring to the hardware oscillators, which is a ticking-clock. It is often not accurate enough to be a human-clock, I've seen figures like 5% inaccuracy. These hardware clocks can slow down or stop ticking when the processor goes to sleep. They can also go backwards in certain situations. Linux provides more than 10 different clocks for different purposes. The POSIX C If you are doing performance measurement using |
Beta Was this translation helpful? Give feedback.
In my opinion, I think it helps to distinguish 2 different concepts of a "clock":
millis()
,micros()
and other timers.Some languages and environments provide a good separation of these 2 concepts (e.g. C++, Java, to some extent Python). Some environments conflate the 2 concepts more than I would like (e.g. C, Unix, Golang).
In the microcontrollers world, the term "clock" is a bit overloaded, …