Page 1 of 1

QEMU time problem

Posted: Sat Apr 30, 2011 12:53 am
by Nessphoro
Hello fellow developers,

I've encountered a problem while getting time from CMOS in QEMU

The problem is converting BCD time to plain binary.

(bcd >> 1) + (bcd >> 3) + (bcd & 0xf), this doesn't work , optimized version doesn't work either.

Any help?

Re: QEMU time problem

Posted: Sat Apr 30, 2011 1:05 am
by xenos
The problem is not related to QEMU, but to your BCD conversion formula. As pointed out in this post, it should be

((bcd & 0xF0) >> 1) + ((bcd & 0xF0) >> 3) + (bcd & 0x0F)

Re: QEMU time problem

Posted: Sat Apr 30, 2011 1:10 am
by Nessphoro
That didn't work either :(

Re: QEMU time problem

Posted: Sat Apr 30, 2011 1:22 am
by shikhin
You say it doesn't work. Mind describing how it doesn't work?

I am not an expert on this, but if the problem is that the time showing up isn't correct, are you even sure that QEMU has the right time in the CMOS?

Re: QEMU time problem

Posted: Sat Apr 30, 2011 1:24 am
by Nessphoro
Well if I display the time, seconds for example, as hexademical it shows the right time, when I use the code above it just shows some well, crap, pardon my French

Re: QEMU time problem

Posted: Sat Apr 30, 2011 5:30 am
by xenos
This could have one of these reasons:
  • The input data is not BCD coded.
  • The number you get out of this formula is wrong (unlikely).
  • The printf function for decimal numbers does not work properly.
Have you checked step by step whether any of these applies to your problem?

Re: QEMU time problem

Posted: Sat Apr 30, 2011 12:46 pm
by Nessphoro
Print for numbers works, but I think that the format is not BCD coded, because the formula produces the wrong output >_>

Re: QEMU time problem

Posted: Mon May 02, 2011 11:22 pm
by Love4Boobies
This is a QEMU problem and has been fixed in version 0.14.