Quantcast
Channel: Active questions tagged windows - Super User
Viewing all articles
Browse latest Browse all 10777

NTP Time - Get time of remote NTP server in command line

$
0
0

Essentially, I want to get an accurate time from a public NTP server, in DOS or powershell.
I know there's the w32tm which can query a remote ntp server, but the result it gives is how much out my computer time is, not the actual time of the remote ntp server.

I've found various windows apps that work exactly as I want, but i can't get the output to a variable to do anything with. I'm dead surprised there's no .exe that just gets the time from a source, or that it wasn't written into w32tm.

Something like ntpquery.exe pool.ntp.org (followed maybe like a timezone or something) with an output of the date / time is all I'm after.


I know there's a command on another question that shows this result:

w32tm /stripchart /computer:fooTracking foo [1.2.3.4].The current time is 19/07/2012 17:39:48 (local time).17:39:48 d:-00.0000840s o:-25.3004160s  [@                          |                           ]

This shows the local system time (which could and in my case is wrong) and how much out it is to the NTP server (example above is 0.00000840s)

If I run this I could get a result of +/- 3000 seconds or even more, which doesn't give me the actual time of the NTP server just tells me how out I am.


What I'm looking for is a way to get the time from the NTP source in DOS / powershell so I can use it as a variable.


Viewing all articles
Browse latest Browse all 10777

Trending Articles