QEMU time problem

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
Nessphoro
Member
Member
Posts: 308
Joined: Sat Apr 30, 2011 12:50 am

QEMU time problem

Post 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?
User avatar
xenos
Member
Member
Posts: 1121
Joined: Thu Aug 11, 2005 11:00 pm
Libera.chat IRC: xenos1984
Location: Tartu, Estonia
Contact:

Re: QEMU time problem

Post 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)
Programmers' Hardware Database // GitHub user: xenos1984; OS project: NOS
User avatar
Nessphoro
Member
Member
Posts: 308
Joined: Sat Apr 30, 2011 12:50 am

Re: QEMU time problem

Post by Nessphoro »

That didn't work either :(
shikhin
Member
Member
Posts: 274
Joined: Sat Oct 09, 2010 3:35 am
Libera.chat IRC: shikhin
Contact:

Re: QEMU time problem

Post 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?
http://shikhin.in/

Current status: Gandr.
User avatar
Nessphoro
Member
Member
Posts: 308
Joined: Sat Apr 30, 2011 12:50 am

Re: QEMU time problem

Post 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
User avatar
xenos
Member
Member
Posts: 1121
Joined: Thu Aug 11, 2005 11:00 pm
Libera.chat IRC: xenos1984
Location: Tartu, Estonia
Contact:

Re: QEMU time problem

Post 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?
Programmers' Hardware Database // GitHub user: xenos1984; OS project: NOS
User avatar
Nessphoro
Member
Member
Posts: 308
Joined: Sat Apr 30, 2011 12:50 am

Re: QEMU time problem

Post by Nessphoro »

Print for numbers works, but I think that the format is not BCD coded, because the formula produces the wrong output >_>
User avatar
Love4Boobies
Member
Member
Posts: 2111
Joined: Fri Mar 07, 2008 5:36 pm
Location: Bucharest, Romania

Re: QEMU time problem

Post by Love4Boobies »

This is a QEMU problem and has been fixed in version 0.14.
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
Post Reply