[ntp:questions] Re: how to question: query an ntp server to return the date

Per Hedeland per at hedeland.org
Thu Jan 27 23:12:37 UTC 2005

In article <mg9Kd.7064$8Z1.5971 at newssvr14.news.prodigy.com> Darren
Dunham <ddunham at redwood.taos.com> writes:
>lb <noone at nowhere.com> wrote:
>> hi. i was wondering if anyone can help me.
>> on a unix machine, i want to be able to query an ntp server and return
>> just the actual date in the form mmddyy. ntpdate -q gives too much
>> info.
>> is there an easy way to do this?
>parse it?  
># ntpdate -d <server> | perl -ne 'if (/^reference
>time.*\s\s\w\w\w,\s(\w\w\w\s\d\d?\s\d\d\d\d)\s\s/) { print "$1\n"; }'

Right, except you want the "transmit timestamp", not the "reference

--Per Hedeland
per at hedeland.org

More information about the questions mailing list