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?

[Webinar] Streamline your web hosting managementRegister Today

x
 
foxrConnect With a Mentor Commented:
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
 
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
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
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
 
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
All Courses

From novice to tech pro — start learning today.