Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB Reading CMOS Clock and setting Windows clock

Status
Not open for further replies.

mikemunnelly

Vendor
Oct 31, 2000
5
0
0
CA
I have a problem where I am losing time in the Windows 98 environment. The CMOS battery retains it's time. Looking under the Windows Knowledge base MS acknowledges that this is a problem with 95/98/nt/2000. Does anybody know how to access the RTC under Windows (preferably in VB6) and dump it to the system time?

Any help appreciated.

Thanks
 
This will require use of the Win32 API functions. There are several that deal with time. One in set particular that might help you out are GetTickCount, GetSystemTime, GetSystemTimeAdjustment, SetSystemTime, and SetSystemTimeAdjustment. These API are rather simple to use.

Accessing the RTC (a BIOS) component is not quite as easy - You will have to use the API DeviceIoControl with the Interupt value for the RTC and the appropraite return STRUCTURE. You will then have to some math to convert the ticks into time. I will leave this research to you - there several Q articles that discuss DeviceIoControl none that I could find specifically about the RTC. But I didn't go through all 328 of them in the October edition of MSDN.

Good Luck

Bruce Voelp
bvoelp@if.rmci.net

Earn AS in 1976 and BS in 1986. Learn to talk with computers when the only interface was 80 column punch cards, and paper tape.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top