My goal is to store timestamps in the range of nanoseconds. Let's say that I have two machines that needs to communicate, at precisely what time a task is done.
Let's just for the sake of the question, say that they a synchronized clocks.
Machine A stores its local time when it's done. Machine B transmits to A, at which time it is done. Machine A then calculates the difference.
My problem is, that the timedifference can actually be up to 60 seconds, but also down to .25ms. So I need to store the time in such a manner, that I can handle both, and calculate the timedifference.
Since time since epoch in nanoseconds is such a big number, I don't think I can store that in any variable that I know of.
How would you tackle this situation? My current though is, that I probably (somehow) could scale the time since epoch in ns down to the bits representing 1 minute, though I have no idea how to do that.
Hope you can help.
Best regards