Commandline utility to adjust time relative to present time (currently set time)

  • Thread starter Thread starter dingdongdingding
  • Start date Start date
D

dingdongdingding

My PC time is adjusted automatically to a time server. However, the
time server is a few minutes ahead of the actual time and I have no
means to correct the timer server. And the firewall blocks me from
synch with a external timer server.

Is there any (commandline) utility that I can run at start up so that
it can adjust the time back by a few minutes and seconds (rather than
setting a actual time).

The sync to the time server is for signon purpose. But I think a few
minutes would affect the signon.

Thanks.
 
My PC time is adjusted automatically to a time server. However, the
time server is a few minutes ahead of the actual time and I have no
means to correct the timer server. And the firewall blocks me from
synch with a external timer server.

Is there any (commandline) utility that I can run at start up so that
it can adjust the time back by a few minutes and seconds (rather than
setting a actual time).

The sync to the time server is for signon purpose. But I think a few
minutes would affect the signon.

Thanks.

You're trying to cure the symptoms. A far better way would be
to cure the underlying cause, by getting your internal time server
to synchronise itself to an accurate time source.
 
The problem is mind. They people owning the server don't see it as a
problem. So is there an utility to do that ? Thanks.
 
In
The problem is mind. They people owning the server don't see it as a
problem. So is there an utility to do that ? Thanks.

If your computer's clock is more than 5 minutes out of sync with the
server's clock, you will have a boatload of problems trying to log in and
actually use your computer. Pegasus is right; you should get them to fix
their ___.
 
I've manually set it before and it's working.

Anyway... is there such a utility that can set the time relative to the
current time in min or secs ? Thanks.
 
The problem is mind. They people owning the server don't see it as a
problem. So is there an utility to do that ? Thanks.

You can run this batch file each time after your PC has been
synchronised to the incorrect central clock:

Line1 @echo off
Line2 if "%2"=="" (
Line3 echo.
Line4 echo Usage: AdjustTime Min Sec
Line5 echo.
Line6 echo where "Min" and "Sec" are positive or negative numbers.
Line7 echo.
Line8 pause
Line9 goto :eof
Line10 )
Line11
Line12 set MM=%1
Line13 set SS=%2
Line14 for /F "tokens=4-7 delims=: " %%a in ('c:\tools\now.exe') do set
H=%%a& set M=%%b& set S=%%c
Line15 set /a NewTime=%H%*3600 + %M%*60 + %S% + %MM% * 60 + %SS%
Line16
Line17 if %NewTime% GTR 86399 set day=next& goto BadTime
Line18 if %NewTime% LSS 0 set day=previous& goto BadTime
Line19 set /a HH=%NewTime% / 3600 & set /a NewTime=%NewTime% %% 3600
Line20 set /a MM=%NewTime% / 60 & set /a SS=%NewTime% %% 60
Line21 echo time %HH%:%MM%:%SS%
Line22 goto :eof
Line23
Line24 :Badtime
Line25 echo.
Line26 echo Error! The adjustment you requested would push the PC clock
Line27 echo into the %day% day. Program aborted.
Line28 echo.
Line29 pause

Notes:
- You must supply positive or negative minute and second adjustment
values, e.g. like so:
AdjustTime -3 0 (=minus 3 minutes, 0 seconds)
- You can download now.exe from here:

http://www.microsoft.com/windows2000/techinfo/reskit/tools/existing/now-o.asp
Adjust Line14 so that it points at the actual location of now.exe.
- Remove the Echo command in line 21 to activate the batch file.
- You may find that your PC keeps syncronising itself to the bad
time server. If so then you might have to turn off the Windows Time
service on your PC.
 
I've manually set it before and it's working.

Anyway... is there such a utility that can set the time relative to the
current time in min or secs ? Thanks.

You could set the Windows time server to use "tick.usno.navy.mil" or a third party time setter.
It can be set to automate the time update process. http://www.atomtime.com
 
I think the difference between the time server and actual is exceeding
5 min soon. I've escalated the problem to help desk next level. I hope
they would fix the problem soon.

If not, I'll use the script is it's still less than 5 min. They warn
me again that I won't be able to signon if I change my time by too
much.

Thanks for all the help. Cheers.
 
Just to update you. No success from help desk. So I tried the script.

It worked..... but the system adjust itself back to the 'wrong' time at
intervals.

So too bad.

Thanks for the help !
 
Just to update you. No success from help desk. So I tried the script.

It worked..... but the system adjust itself back to the 'wrong' time at
intervals.

So too bad.

Thanks for the help !

I warned you about this and I gave you the recipe to prevent it from
happening.
 
In
I heard you but no harm trying, right since the recipe didn't work.
Thanks.

What is the reason that the people responsible for maintaining your DCs
don't want to correct the time? I find this unfathomable.
 

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

Back
Top