Unsolved Qt C++ microSecond And Nanosecond time calculate
-
Hello Guys I need Qt C++ serial port read microsecond an nanoSecond calculate and time stamp Please Can you help me
-
@alonewolfsemmmy Sorry, can you please explain better? I don't understand what you want. Do you want to read time stamps over serial bus, or what?
-
Yes I definetely My Friend When serial port read and microsecond timestamp read
-
Yes I definetely @jsulm
-
@alonewolfsemmmy What exactly do you want to calculate with these timestamps? What is the problem? You know how many microseconds is a second, right? So, should be easy to calculate.
-
Also you can use std::chrono::duration to convert between units of duration.
-
You of course know that in most desktop OS the userland time granularity is limited to the millisecond magnitude? If you want to truly track and make use of microsecond time events you must do it in the kernel and/or use an RTOS (which then isn't relevant to Qt).
Here is an example. You send uart data at some microsecond periodic rate and expect it to be read and timestamped on the receiver with the same normalized periodic frequency that it was sent. Well, it won't be because if it is a userland program that is timestamping the data when it arrives then there is no guarantee that the reading process wakes up exactly when the data becomes available.