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

Darren Dunham ddunham at redwood.taos.com
Thu Jan 27 17:10:42 UTC 2005

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"; }'

Not exactly the format you want, but it should be pretty simple to
modify that.

Darren Dunham                                           ddunham at taos.com
Senior Technical Consultant         TAOS            http://www.taos.com/
Got some Dr Pepper?                           San Francisco, CA bay area
         < This line left intentionally blank to confuse you. >

More information about the questions mailing list