Mail Archives: djgpp-workers/2003/05/29/23:27:08
DJ Delorie wrote:
>Please keep djgpp-workers on the recipient list.
>
>
Sorry. I was using the Reply button instead of the Reply All button.
>
>
>>>If the count's wrong, it's a bug. The question is - are we *supposed*
>>>to be counting to 65535, or 65536? IIRC there are some oddities in
>>>how the timer works.
>>>
>>>
>>>
>>>
>>>
>>Well, the code programs a count of 65535:
>>
>> outportb (0x43, 0x34);
>> outportb (0x40, 0xFF);
>> outportb (0x40, 0xFF);
>>
>>whilst it assumes a count of 65536:
>>
>> rv = ((uclock_t)tics << 16) | (msb << 8) | lsb;
>>
>>I'll check it on the real PIT, and get back to you.
>>
OK. It does work. There was a jitter of about 1us when comparing it to
RDTSC.
>>
>>
>
>No, my question was whether a count of 65535 was required to get the
>total tic count correct for a day.
>
>
>
uclock() assumes 0x1800B0 tics in a day.
There are 1193180*86400/65536 = 1573040.04 (0x1800B0) tics in an day.
With a timer period of 65535, it would have 1573064.04 (0x1800C8) tics
in a day.
It would gain one full tic per hour, and would be out by 1.5 seconds at
the end of the day.
Thankyou for your great tools.
Ben
- Raw text -