I need to transfer the current operating system’s date and time up to micro-seconds accuracy from party A to party B over TCP/IP.
-
What is the least number of bytes
that can be used to represent this
without sacrificing accuracy? -
And how to convert the date and time
to your bytes format
using C#?
The least number of bits would be to use microseconds since some fixed point in time. But when you do this, at some point in the future your time stamps will overflow.
If you pick the fixed point in time as yesterday for instance. then 5 bytes will be enough to encode times from yesterday until the middle of next week.
But this seems unnecessarily complicated.
DateTime.Tickuses only 8 bytes of space. it’s accurate to 1/10th of a microsecond and spans all of recorded human history, it references a defined point in time (January 1, year 1) and most importantly, its standard