I have a Python program and a C ++ program. They communicate through IPC.
Python will send JSON {"event_time": time.time ()} to a C ++ program.
The C ++ program will record this time and add the event to its own event queue according to the time sent through Python. I need operations such as comparing and subtracting two time values from Python and C ++.
Python time.time () is a simple double number that can be easily compared and sorted (for example, it's something like 1428657539.065105).
Is there something equivalent in C ++ for this value? Should they at least agree with a number exactly milliseconds, but not the second? Ie, if I run two programs at the same time, they should get the same value in seconds and a slight difference in the millisecond range.
If not, then I should return to using the strategies YEAR, MONTH, DAY, HOUR, MIN, SEC, MILLISECOND. Comparison, subtraction between two times, etc. It will be more complicated than double comparison and double subtraction.
source
share