
Getting date and time from two 32 bit numbers
Quote:
> Hi,
> I have a problem of handling 64 bit quantity. Can anyone provide me
> any inputs (or solution)??? I explain the problem below:
> I have two 32-bit numbers(Stored 64 bit quantity as two 32 bit
> quantities.- one being high 32 bit and the other low 32 bit). This
> whole 64 bit number gives number of milliseconds past 1st January
> 1600. I have to arrive at date and time.(in other words, I have to
> convert this number of milliseconds to 'a' years, 'b' months, 'c'
> days, 'd' hours, 'e' minutes, 'f' seconds and
> 'g' milliseconds.). This involves division of two 32 bit
> number by a 32 bit number and storing the result in a 32 bit
> number. Hope problem is clear. Can anyone help me???
> thanks,
> Kishore.
Your best bet is to get a large number library and just copy the num
into that, otherwise you could easily code some routines yourself.
Naively you could repeatedly subtract 31,536,000,000 until you get a
result <= it, that is the number of years, then just subtract 86,400,000
until you get a no.....
Subtraction is rather simple, if (a, b) is your input (high, low) and
you are subtracting (c, d) then you get
b1 -= d;
a -= (c + (b1 > b));
b = b1;
Tom
--
Want your academic website listed on a free websearch engine? Then
please check out http://www.*-*-*.com/ , it's entirely
free
and there are no adverti{*filter*}ts.