Solved

net time & w32tm problem

Posted on 2004-04-30
16
2,867 Views
Last Modified: 2012-06-21
I have a client/server application in .NET in which communication between the two is time sensitive and requires both machines to be sync'd.

XP dos, and the version of dos on win2k are different.  So some of the commands are different.  

IE:  winxp is w32tm /resync
      win2k is w32tm -s

These are the steps I think I need to do:
1)  set sntp server. This currently works on both machines like this
        net time /setsntp:<machineName>

2) update the time, and if possible set interval at which it will check to make sure the time is in sync.

win2k - currently doing:
           net time stop w32time
           w32tm -s (or -once?) -period 65532 (to sync ever 8 hours)
           net time start w32time

now this works...the first time when I use -once, but not -s.
Both -s and -once will sync the time after the service is started (unless the -s attempt just failed and is using previous settings from my -once attempt).

However,  i set the period to 1440 (to sync every minute) and it doesn't sync every minute.  I've set the time ahead and back (knowing that it handles those 2 scenarios differently... i think if its back it slowly syncs and if its ahead it'll do it immediately).

and with winXP  this command works :
          net time /set /y

however that command does not work on win2k? ? ? ?   i get "System error 5 has occured"

I have done research on this system error 5 and can't seem to figure out what the problem is.
Anyways.. seems like there are a lot of examples on the web.. so please.. DON'T POST LINKS!!  lol.  

I'll save you the trouble to what I've seen and what I've tried....  

http://www.tycho7.com/Software/Win2k/w32tm_service.htm

http://www.winnetmag.com/Windows/Article/ArticleID/20079/20079.html
0
Comment
Question by:bswiftly
  • 9
  • 7
16 Comments
 
LVL 6

Accepted Solution

by:
TMWSIY earned 50 total points
ID: 10960585

are you supplying a server to sync with in the cmd?

like:

net time \\someServer /set /yes

?
0
 
LVL 1

Author Comment

by:bswiftly
ID: 10960832
you mean when I try it in win2k?  

If I supply the computer name as you suggest, I get the System error 5 message as well.

Although as I understand it, after I have set the sntp server, I can just run w32tm -s  and it'll sync to that server.  

i'm assuming that:

net time /set

command just calls the w32tm function? am I right?

0
 
LVL 6

Expert Comment

by:TMWSIY
ID: 10961159
Sorry I cant be of more help here but I'm still on an NT domain :(

With nt I supply a server name the the cmd sync the time with that server, reguardless of sntp.

Try the cmd from the cmd line and see if it works.  Just use the server name of your sntp server.

I have to disable the w32tm service in XP clients becuase NT domains, and workstations, do not support it.  However I'm not sure about 2k machines.

In xp you can use the /setsntp to set up your clients to sync with your sntp server.

/SETSNTP[:ntp server list]
                Sets the NTP time servers to be used by this computer.  This
                may be a list of IP addresses or DNS names separated by spaces.
                If multiple timeservers are listed, the list must be surrounded
                by quotes.

HTH
Trey
0
 
LVL 6

Expert Comment

by:TMWSIY
ID: 10961174
net help time

for full details...

Might want to run this from the cmd line on an 2k workstaion to see its capabilities.
0
 
LVL 6

Expert Comment

by:TMWSIY
ID: 10961203


Sorry missed this:
>>Although as I understand it, after I have set the sntp server, I can just run w32tm -s  and it'll sync to that server.

if it still does not work try syncing with this cmd as a workaround:

net time \\sntp /set /yes

where sntp is the computer name of your sntp server.
0
 
LVL 1

Author Comment

by:bswiftly
ID: 10961226
hey,
that /setsntp command you mentioned was in my original post.  

and yes i've been through the net time ?  list of options and they are different ..as i had mentioned win2k's equivalency of xp's w32tm /resync  is w32tm -s.  net time options are different as well but on win2k i've been using the win2k list and i still get that error.

Thanks for the input though.

I'm wondering why I can't find a lot of helpful documentation with M$
0
 
LVL 6

Expert Comment

by:TMWSIY
ID: 10961539
Did you see these?

120944 - Using NET TIME for all Workstations and Servers
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q120944

How to Configure an Authoritative Time Server in Windows 2000
http://support.microsoft.com/default.aspx?scid=216734

and for the time service docs:
http://www.microsoft.com/windows2000/docs/wintimeserv.doc

R U running a 2k domain?

0
 
LVL 1

Author Comment

by:bswiftly
ID: 10961581
Pretty sure its a 2k domain.  

Haven't seen those links but if you look at the links I posted...there is more information than in the ones at the microsoft site that you posted there..  i'm confused as to why this is happening.
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 6

Expert Comment

by:TMWSIY
ID: 10961617
FYI

I use this cmd in my startup script on my NT domain:

net time \\mailsvr /set /yes

so each computer on the network gets it time sync'ed with my mail server at every logon.

When user log on their 2000 workstaions it does sync the time.  Some thing to consider if you have control over the domain or access to the admin :)

Good Luck,
Trey
0
 
LVL 1

Author Comment

by:bswiftly
ID: 10961656
well the way I have it working right now is as above, it checks the OS, and then runs a batch file to set up the time server.  

As posted initially, I have it working on both OS's when the service starts (ie on boot up).   But the w32tm -period  parameter doesn't seem to fire.  I set the interval to 1 minute and 3,4,5 minutes go by without updating the time...  I guess this was my main question.   Is my syntax wrong for the -period command.?

0
 
LVL 6

Expert Comment

by:TMWSIY
ID: 10961889
not sure...

fire up regedit and look here:

MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Parameters

and check the period key.

Used to control how often the time service synchronizes. If a value is given, it must be one of the
special values listed below.

     65531, "DailySpecialSkew" = once every 45 minutes until successful one time, then once every day
     65532, "SpecialSkew" = once every 45 minutes until successful three times, then once every eight hours (three times per day) [default]
     65533, "Weekly" = once every week (seven days)
     65534, "Tridaily" = once every three days
     65535, "BiDaily" = once every two days
     0 = once per day
     freq = freq times per day. If you choose to add a value other than any of those specified above, you must use this option.


Dont modify these settings just check to see if it is set.
0
 
LVL 6

Expert Comment

by:TMWSIY
ID: 10962000
If you look at the documentation the -s switch forces the computer (or the local computer if none is specified) to resynchronize, then *exits*.

Also found this at the end of the win32time docs:

A:
I know my computer's time is incorrect. Why hasn't it synchronized yet?
Q:
A clock on a computer does not adjust itself immediately. A computer synchronizes with the time server at system startup and then every 45 minutes until it has successfully synchronized three times. When the clocks are correctly synchronized, they sync again after eight hours, and every eight hours after that. (For a description of how to manually change this setting, see "W32Time Registry Entries" earlier in this article.)

and this is true for the time you have selected:

 65532, "SpecialSkew" = once every 45 minutes until successful three times, then once every eight hours (three times per day) [default]

0
 
LVL 1

Author Comment

by:bswiftly
ID: 10962051
ah.. i haven't read that freq. thing before... maybe just missed it..  i thought i could just say -period 1440 for every minute.  

so do i go w32tm -s -period freq 1440 ?   or whats the syntax there then ?

just w32tm -s -freq 1440?

I'll test and let you know if you don't first
0
 
LVL 6

Expert Comment

by:TMWSIY
ID: 10962146
You can only use these numbers:

0 = once per day
65535 = once every two days
65534 = once every three days
65533 = once every week (seven days)
65532 = once every 45 minutes until you get three good syncs, then once every eight hours (three/day)
65531 = once every 45 minutes until you get one good sync, then once every day

If you use anything else it is times/day.  so 1440 would be once a minute.  I think freq is just the number you pass to it.  try running the cmd with the -v switch so you can see whats going on.

w32tm -s -period 1440 -v

0
 
LVL 1

Author Comment

by:bswiftly
ID: 10962763
you have to put in freq.  
eg

if you use one of the numbers listed, you don't have to...

w32tm -s -period 65532     //no freq needed

w32tm -s -period freq 1440  //have to list freq if you are going to use a custom #.  that works.

0
 
LVL 1

Author Comment

by:bswiftly
ID: 11008525
thanks for your help.. i sort of worked around it myself but i'll give you the points for the effort.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
In this article, I will show you HOW TO: Suppress Configuration Issues and Warnings Alert displayed in Summary status for ESXi 6.5 after enabling SSH or ESXi Shell.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now