How to get the timestamp since midnight UT

602 views Asked by At

How can I convert some hex values into the timestamp since midnight UT from an ICMP packet (reference rfc792) like in wireshark:

enter image description here


I've converted the hex value DE AD BE EF to decimal 3735928559 and tried this to get the originate timestamp:

TimeSpan t = TimeSpan.FromMilliseconds(3735928559);

string timestamp = string.Format("{0:D2}h:{1:D2}m:{2:D2}s:{3:D3}ms",
                t.Hours,
                t.Minutes,
                t.Seconds,
                t.Milliseconds);

But I get 05h:45m:28s:559ms instead of 18 days, 0 hours, 14 minutes and so on like in wireshark. (I know the date format is not the same, but the value is nevertheless wrong).

0

There are 0 answers