5

I have the following know pair of hex values and dates:

7D 92 D2 5C = 26/03/2009 - 09:28
7D 92 DA CC = 27/03/2009 - 11:12
7D 92 E3 56 = 28/03/2009 - 13:22
7D 92 EC 4F = 29/03/2009 - 17:15
7D 92 F3 16 = 30/03/2009 - 12:22
7D 92 FB 1A = 31/03/2009 - 12:26
7D 93 0B 01 = 01/04/2009 - 12:01
7D 93 12 88 = 02/04/2009 - 10:08
7D 93 1A 30 = 03/04/2009 - 08:48
7D 93 22 DD = 04/04/2009 - 11:29
7D 93 2A D5 = 05/04/2009 - 11:21

I cant figure out how to convert from the one to the other....

Anyone recognise the hex format?

Al

3 Answers 3

11

It's a simple bitfield, even though that's a pretty weird time format :)

1111101100100101101001001011100
                         011100 - 28 minutes
                    01001       - 09 hours
               11010            - 26 days
           0010                 - month 3 (zero-based, hence 2)
11111011001                     - 2009 years

would be my guess.

7
  • beat me to it. :-) I have seen this format before, but only in another stackoverflow question!
    – bobince
    Apr 5, 2009 at 15:46
  • Yikes ... Initially I tought Unixtime, since none of the common Windows time structures fit into 32 bits, but this is ... strange. Especially that the month is seemingly zero-based but days are not.
    – Joey
    Apr 5, 2009 at 15:48
  • Wow. Thank you Johannes. I really apreciate the answer. And so fast too. Brilliant!
    – Alan
    Apr 5, 2009 at 15:53
  • I looked at dates about 1 day apart, that gave the first clue.
    – starblue
    Apr 5, 2009 at 15:54
  • Well, bitfields were actually my second guess and I sat down with calc and notepad (very handy tools :)) and looked each component up in the bit representation, with just a brief pause with the month :)
    – Joey
    Apr 5, 2009 at 15:56
2

12 bit year, 4 bit month (0-based), 5 bit day, 5 bit hour, 6 bit minute.

Nice puzzle :-)

0
1

i realize that this is an old topic, but i found it useful and thought i would add to it my 2 cents.

u8 getMinutes(u32 in)
{
    return in & 0x3f;
}

u8 getHours(u32 in)
{
    return (in>>6) & 0x1f;
}

u8 getDays(u32 in)
{
    return (in>>11) & 0x1f;
}

u8 getMonths(u32 in)
{
    return ((in>>16)& 0xf)+1;
}

u16 getYears(u32 in)
{
    return (in>>20) & 0x7ff;
}

void printDate(u32 in)
{
    printf("%d/%d/%d - %d:%d", getDays(in), getMonths(in), getYears(in), getHours(in), getMinutes(in));
}

int main(int argc, char *argv[])
{
    u32 t = 0x7D92D25C;
    printDate(t);
    return 0;
}

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.