By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,677 Members | 1,224 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,677 IT Pros & Developers. It's quick & easy.

O.T. - trying to sync w/ nist time server...

P: n/a
MLH
I have database apps that depend on accurate time
settings on the system clock. Fancy that, huh? Well,
am trying to sync w/ the gvt's nist time server. From
a CMD window in Win XP, I type the following:

C:\DB\TimNall>Gonna set time wrong - say to 8AM

C:\DB\TimNall>time
The current time is: 12:07:12.80
Enter the new time: 8:00:00

C:\DB\TimNall>time
The current time is: 8:00:02.20
Enter the new time:

C:\DB\TimNall>net time /setsntp:time.nist.gov
The command completed successfully.
C:\DB\TimNall>time /t
08:00 AM
Ideas anyone? Whatever way you suggest, I will need
to call it from within A97 - probably from a VBA procedure.

Nov 13 '05 #1
Share this Question
Share on Google+
8 Replies


P: n/a
MLH
Oops...
First post was missing a few lines...

C:\DB\TimNall>net time /set
Could not locate a time-server.

More help is available by typing NET HELPMSG 3912.

The net time /set command is what's failing for me.
Nov 13 '05 #2

P: n/a
The SHELL function allows you to execute a command from within VBA. All you
now have to do is determine how to enter both "/set" and the time to which
you want the clock set on a command line, rather than supplying the time in
response to a prompt. I'd guess there is a way to do so, but wouldn't offer
a "warranty".

Larry Linson
Microsoft Access MVP

"MLH" <CR**@NorthState.net> wrote in message
news:4q********************************@4ax.com...
Oops...
First post was missing a few lines...

C:\DB\TimNall>net time /set
Could not locate a time-server.

More help is available by typing NET HELPMSG 3912.

The net time /set command is what's failing for me.

Nov 13 '05 #3

P: n/a
MLH wrote:
I have database apps that depend on accurate time
settings on the system clock. Fancy that, huh? Well,
am trying to sync w/ the gvt's nist time server. From
a CMD window in Win XP, I type the following:

C:\DB\TimNall>Gonna set time wrong - say to 8AM

C:\DB\TimNall>time
The current time is: 12:07:12.80
Enter the new time: 8:00:00

C:\DB\TimNall>time
The current time is: 8:00:02.20
Enter the new time:

C:\DB\TimNall>net time /setsntp:time.nist.gov
The command completed successfully.
C:\DB\TimNall>time /t
08:00 AM
Ideas anyone? Whatever way you suggest, I will need
to call it from within A97 - probably from a VBA procedure.

I remember, in the cobwebs of my mind somewhere, you could pass
something in and out in DOS. Syntax like
Time <y.Txt >T.Txt
where Y.Txt has the input and T is the output.
Nov 13 '05 #4

P: n/a
MLH <CR**@NorthState.net> wrote in
news:4q********************************@4ax.com:
Oops...
First post was missing a few lines...

C:\DB\TimNall>net time /set
Could not locate a time-server.

More help is available by typing NET HELPMSG 3912.

The net time /set command is what's failing for me.


I don't understand what you're asking.

Your first question looked like you wanted to set time by a
recognized time server, and that it wasn't working. I tried it, and
it doesn't work for me, either.

This new post looks like a completely different question.

Have you gone through the steps in this article:

http://msdn.microsoft.com/library/de...l=/library/en-
us/dnw2
kmag01/html/TimeWin2K.asp

I can't seem to get it to work on my computer either, but the
">w32tm -once" command seems to work, though it may be that it only
worked after I ran your first command. That is, it appears that the
/setsntp switch only sets which time server is used, which you can
check by running "net time /querysntp". If you run:

net time /setsntp:tick.usno.navy.mil

and then check "net time /querysntp", it will return
tick.usno.navy.mil. If you then run:

net time /setsntp:time.nist.gov

and then check "net time /querysntp", it returns time.nist.gov.

Now, if you run one of those /setsntp commands and then run
"w32tm -once" it appears to me that it sets the time, as long as
your firewall lets you through to the remote time server.

You should be able to script this and use SHELL to execute it.
You'll probably want to direct the output of w32tm to NUL, though.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #5

P: n/a
MLH
I don't understand what you're asking.

Your first question looked like you wanted to set time by a
recognized time server, and that it wasn't working. I tried it, and
it doesn't work for me, either. Sorry about that. First 'n second post in thread were really
supposed to be ONE post. What I left off the first was the
time /set command in CMD window. That one doesn't seem
to be working either.
Have you gone through the steps in this article:

http://msdn.microsoft.com/library/de...l=/library/en-
us/dnw2
kmag01/html/TimeWin2K.asp

Am about to now...
Nov 13 '05 #6

P: n/a
MLH
http://msdn.microsoft.com/library/de...l=/library/en-
us/dnw2kmag01/html/TimeWin2K.asp

Very helpful info there, yes. But I'm on XP, so some syntax change
was required. Ultimately successful. Thx. Here's screens of commands
processed...

C:\DB\Ajuda>time
The current time is: 10:54:01.39
Enter the new time: 8:00:00.00

C:\DB\Ajuda>time
The current time is: 8:00:01.04
Enter the new time:

C:\DB\Ajuda>w32tm /resync
Sending resync command to local computer...
The command completed successfully.

C:\DB\Ajuda>time
The current time is: 10:56:10.14
Enter the new time:

C:\DB\Ajuda>
Nov 13 '05 #7

P: n/a
Salad wrote:
I remember, in the cobwebs of my mind somewhere, you could pass
something in and out in DOS. Syntax like
Time <y.Txt >T.Txt
where Y.Txt has the input and T is the output.


Or pipe it:
c:\>echo.|time

displays time (note no space between "echo" and ".")

Also:
c:\>net time \\%COMPUTERNAME%|find "Current"

The pipe isn't necessary there but does suppress the exra CRLF and "The
command completed successfully"

You can suppress the prompt on the first syntax too with:
c:\>echo.|time|find "current"

to set the time:
c:\>echo 09:00:00|time
Nov 13 '05 #8

P: n/a
Trevor Best wrote:
Salad wrote:
I remember, in the cobwebs of my mind somewhere, you could pass
something in and out in DOS. Syntax like
Time <y.Txt >T.Txt
where Y.Txt has the input and T is the output.

Or pipe it:
c:\>echo.|time

displays time (note no space between "echo" and ".")

Also:
c:\>net time \\%COMPUTERNAME%|find "Current"

The pipe isn't necessary there but does suppress the exra CRLF and "The
command completed successfully"

You can suppress the prompt on the first syntax too with:
c:\>echo.|time|find "current"

to set the time:
c:\>echo 09:00:00|time


Damn. Reminds me of the good times in DOS when developers were
developers and fancy WYSIWYG was just germanating in the minds of others.
Nov 13 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.