I have an unsigned char array whose size is 6. The content of the byte array is an integer (4096*number of seconds since Unix Time). I know that the byte array is big-endian.
Is there a library function in C that I can use to convert this byte array into int_64 or do I have to do it manually?
Thanks!
PS: just in case you need more information, yes, I am trying to parse an Unix timestamp. Here is the format specification of the timestamp that I dealing with.
A C99 implementation may offer
uint64_t(it doesn’t have to provide it if there is no native fixed-width integer that is exactly 64 bits), in which case, you could use:If your C99 implementation doesn’t provide
uint64_tyou can still useunsigned long longor (I think)uint_least64_t. This will work regardless of the native endianness of the host.