W32Time and Clock ticks

G

Guest

W32Time affects the computer's clock.
How does the change in machine clock and clock Frequency affect the clock
ticks?

Thanks a lot
 
R

Ron Lowe

Dan Porat said:
W32Time affects the computer's clock.
How does the change in machine clock and clock Frequency affect the clock
ticks?

Thanks a lot


W32time is the Windows service which keeps the
time-of-day clocks synchronised. ( Not the CPU clock. )

Please see the following article for a good discussion onW32Time:
The Windows Time Service
http://www.microsoft.com/windows2000/docs/wintimeserv.doc

Depending on the amount of time skew, it does say that it adjusts the clock
frequency.
But it's adjusting the time-of-day clock, not the CPU clock.

I don't know what it actually does, but these are my thoughts...

I'm not 100% sure what hardware the time-of-day clock is based on these
days, but in ye olde days, the CMOS clock was used at boot-up time to
initialise the OS clock. The OS then kept it's own track of elapsed time
based on counting interrupts ( IRQ 0, if I recall correctly ), that occours
every 55mS ( or 18.2 times/second. ).

CPU clock frequency is not a factor in this, the 55mS timer interupt is
coming from a
8253/8254 PIT - Programmable Interval Timer.

So if the windows internal clock is still based on the Time-of-Day 55mS
'clock tick' interrupts, then to adjust the clock speed, the OS needs to
either:

- re-program the dividers on the 8253/8254 PIT -
Programmable Interval Timer's counter 0 ( time-of-day clock ),
to hardware alter the frequency of interrupts, or....

- make adjustments in the interrupt handler software to scale the
elapsed time each interrupt represents.
 
G

Guest

Hi Ron!

Thanks a lot for your answer.
Correct me if i am wrong.
What i understood is that the clock tick count never changes and is always
once every 10- Milli interrupt based (unless the HW is faulty and
disregarding the elapsed mistake).
The Time-Of-Day clock is probably CMOS based plus some adjustments of the OS.

This means that i cannot base Timers (let's say i want an event to happen at
12:00:00) on tick count (if i know now it's 11:00:00 so i want the event to
happen 3600000ticks from now) but only on the Time-Of-Day-Clock, as it is for
sure be the one which is always tuned (thanks to W32Time).

This means i should always Base timers and shoot events according to Time
and not to tick count which i get from the system.

Am i correct?

Thanks a lot
 
R

Ron Lowe

--
Best Regards,
Ron Lowe
MS-MVP Windows Networking


Dan Porat said:
Hi Ron!

Thanks a lot for your answer.
Correct me if i am wrong.
What i understood is that the clock tick count never changes and is always
once every 10- Milli interrupt based (unless the HW is faulty and
disregarding the elapsed mistake).
The Time-Of-Day clock is probably CMOS based plus some adjustments of the
OS.

My understanding is that the CMOS clock is only used at
boot-up to initialise the OS software clock.

The OS then keeps track of time independently, based on timer interrupts.

Now, my understanding on that point may be out-dated.

This means that i cannot base Timers (let's say i want an event to happen
at
12:00:00) on tick count (if i know now it's 11:00:00 so i want the event
to
happen 3600000ticks from now) but only on the Time-Of-Day-Clock, as it is
for
sure be the one which is always tuned (thanks to W32Time).

This means i should always Base timers and shoot events according to Time
and not to tick count which i get from the system.


I'm sorry, I don't know how to programatically determine elapsed time or
time of day.
There may be different methods, with differing uses and applicability.
There will no doubt be API calls you can make to do this.
Perhaps you should re-post in a programming forum.
Also, search MSDN, there may be sample code to do what you want.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top