Reputation: 423
How do I get from a hex timestamp e.g. 33 88 72 52 to human readable? I've pulled it from a file as an array byte = {0x33,0x88,0x72,0x52}, I think it is little endian... Been a bit stuck on this for an hour or so and google hasnt been much help. Thanks.
Upvotes: 2
Views: 1698
Reputation: 882028
That depends entirely on the encoding, which isn't specified.
However, at four bytes, it could be a time_t
value which is supported by this program:
#include <stdio.h>
#include <time.h>
int main (void) {
time_t tm = 0x52728833; // little-endian 0x{33,88,72,52}
printf ("%s\n", ctime (&tm));
return 0;
}
This prints out:
Fri Nov 1 00:41:23 2013
which is only a few days ago (from when this question was asked).
So that's the most likely possibility (almost a dead certainty, I would venture) and you can use all the wondrous time manipulation and printing features of ISO C to work it out.
Upvotes: 5