Link to home
Start Free TrialLog in
Avatar of arunykand
arunykandFlag for United States of America

asked on

Setting Windows Time and Date

I have two computers one running WinXP (Machine-A), which is a stand-alone (no keyboard/mouse, but has a 8 button joystick & monitor) and another is a laptop running Win7 (Machine-B).  

Typical execution is, WinXP boots up and runs a custom software and when required, the Win7 laptop connects to the WinXP machine via cross over cable and access a network share to download some files to the laptop.  

The issue we are running into is, the CMOS battery on the WinXP machine is dying and reverting the system time to some date in 2011.  With this issue present, when the Win7 machine tries to access the fileshare on the XP machine, it fails.  For the longest time, I used to think this was a username/password issue, but it is directly related to the time difference between the two machines (If we manually make one match the other, the file share works like a charm).  

So now onto my question:  I can see two options for me to fix this:

1 ) try to do a 'net time' from the XP machine to get the time from the Win7 machine when it is hooked up and set it's time to the correct time.  (This might not work due to security policies, I need to check)

2).  Modify my software on the XP machine to enter a time/date manually (Via joystick, i'll have to figure out how to do this) and set that time for Windows.  

Can you please tell me how (Again, i'll figure out how to get the user to input the time via the joystick) to take the time in 'HH:MM AM/PM' and  date in 'MM/DD/YYYY' format and set it for Windows time?  I am using C++, so code snippets on how to accomplish this will be very helpful.  BTW, I do have psexec available on both PC's but I am not sure I can guarantee that the 'time' & 'date' commands via psexec will work 100% of the time, so that's why I figured having the user enter the time manually will be the best approach

Thanks so much!
Avatar of Scott Fell
Scott Fell
Flag of United States of America image

Avatar of arunykand


I am pretty sure that remote desktop/assistance is disabled on the XP side for security compliance issues :(
>>  the CMOS battery on the WinXP machine is dying   <<  then the easiest solution is to replace the battery; it is a CR2032 coin type battery, supplying 3V and costs about 3-4$
5 minutes work to replace the battery, and set the bios right
Replacing the battery is cheap, but not what the customer wants. I am looking to fix the software so that even if the battery died there will be a backup solution. Any help to implement this via software??
>>  Replacing the battery is cheap, but not what the customer wants  <<   if his cars is out of gas, he may want what he likes, but in order to run, he 'll need gas
here's the same : replace the battery
I am not arguing about replacing the battery. I just need to figure out how to set the time via C++ as I had requested in my original post! If someone can help me that would be great
i agree - but if the battery is low,  other settings will change, or vanish, or be reset
how will you cope with these then?
that is why i suggest there is only 1 true solution : a new battery
Like I said before I am not disagreeing with you but the change is requested from management not me. I think we will be doing both changing the battery as well as updating the source code as a fail proof way. If you could please point me the right direction has to how to change a time from C++ it would be great thank you
Avatar of nobus
Flag of Belgium image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks for your help Nobus
glad to help where i can - i hope someone comes in that can help you better than me
and plse - don't  assign points, unless it helps you