System Clock Losing Time

We have a recurring problem in one my company's software products.  While our program is running the system clock starts falling behind, as much as 2-minutes per day. After the system is rebooted the time is correct again, which makes me think there is a BIOS clock (or something similar) that does not lose time. I'm assuming something in our software is preventing the system clock from keeping up.  My question is "How can we re-synchronize the system clock with the "BIOS" clock without re-booting the system?".
FinchAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jefflansCommented:
  The Linux system has a software clock because it is complicated and slow to check the hardware clock all the time.

   But the software clock is not always correct. It is called by time interrupts that is generated by hardware. In your case, probably your process is taking a great parte of the CPU's time, causing the delay of the time interrupt.

   You can synchronize the system clock by executing the command:

   date | clock

   Hope this helps!

   jefflans
0
FinchAuthor Commented:
How can I accomplish this in a C++ program? By the way I'm running on the Win-NT 4.0 workstation platform.
0
jefflansCommented:
You can schedule a script in crontab to do this!

   Log as root.

   Edit your /etc/crontab file and add this line:

"00 * * * * root /usr/bin/sync_date"

whitout the quotes.

Then, create a file called sync_date in your /usr/bin directory containing:

   date | clock

Do not forget do give execution status for the archive with chmod.

Doing this, the sync_date will be executed every hour.

   Hope this helps.

   jefflans

0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

FinchAuthor Commented:
When I posted this question under windows I neglected to mention that I am running Windows NT 4.0 operating system.  The LINUX solution does not help unless there is a method that I'm not aware of.  Is there a similar fix to my problem under WinNT?  Thanks for your help.
0
jefflansCommented:
  I do not know anything like this in WinNT. I´ll try to find out an answer. By the way, why did you ask a question in the Linux section if your doubt is related to WinNT ?

   If you have a licensed copy of Winnt, you can try the Microsoft Support... They have 0.0001% of chance to help you. I wish you good luck!!!

   jefflans
0
foxrCommented:
You do not mention if you are on a network or if you have another server; however, try this (assuming you have some networkinging running:

net time  \\servername /set /y  <- the spaces are required
 The servername can be the local machine.
 this can be scheduled to run automatically with the NT AT command.
Hope this helps.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux

From novice to tech pro — start learning today.