How to get the OS time remotely?

Hello all,

Is there any way to get the OS time of a remote node programaticaly?

Guszti

Gusztav Roka wrote:

Is there any way to get the OS time of a remote node programaticaly?

Since you didn’t specify a language, how about shell script?

#!/bin/sh
if [ “$1” = “” ] ; then
echo $0: you must specify a node
exit 1
fi

on -n $1 date

:wink:


Chris Herborth (cherborth@qnx.com)
Never send a monster to do the work of an evil scientist.

Chris Herborth wrote:

Gusztav Roka wrote:
Is there any way to get the OS time of a remote node programaticaly?

Since you didn’t specify a language, how about shell script?

#!/bin/sh
if [ “$1” = “” ] ; then
echo $0: you must specify a node
exit 1
fi

on -n $1 date

I’d like to do that with a small program writen in “C”.

You might want to peek into source code of spin. It has code to do that,
albeit somewhat crude.
It’s on the 3rd party CD…

“Gusztav Roka” <gusztav_roka@mailbox.hu> wrote in message
news:cp6jdd$517$1@inn.qnx.com

Chris Herborth wrote:
Gusztav Roka wrote:
Is there any way to get the OS time of a remote node programaticaly?

Since you didn’t specify a language, how about shell script?

#!/bin/sh
if [ “$1” = “” ] ; then
echo $0: you must specify a node
exit 1
fi

on -n $1 date

I’d like to do that with a small program writen in “C”.

Another option would be to run an NNTP daemon, and get the
clocks synchronized on all your machines.

John Nagle

Gusztav Roka wrote:

Hello all,

Is there any way to get the OS time of a remote node programaticaly?

Guszti

I think you mean NTP

But could also just run inetd and connect to the time service, which
spits out a time_t I believe

John Nagle wrote:

Another option would be to run an NNTP daemon, and get the
clocks synchronized on all your machines.

John Nagle

Gusztav Roka wrote:

Hello all,

Is there any way to get the OS time of a remote node programaticaly?

Guszti


cburgess@qnx.com

Colin Burgess <cburgess@qnx.com> wrote:

I think you mean NTP

You could do it with NNTP – there’s a date command :slight_smile:

Cheers,
-RK

But could also just run inetd and connect to the time service, which
spits out a time_t I believe

John Nagle wrote:
Another option would be to run an NNTP daemon, and get the
clocks synchronized on all your machines.

John Nagle

Gusztav Roka wrote:

Hello all,

Is there any way to get the OS time of a remote node programaticaly?

Guszti


\

cburgess@qnx.com


[If replying via email, you’ll need to click on the URL that’s emailed to you
afterwards to forward the email to me – spam filters and all that]
Robert Krten, PDP minicomputer collector http://www.parse.com/~museum/

Gusztav Roka wrote:

Is there any way to get the OS time of a remote node programaticaly?

I found an easy way, if you’ve got QNet running… use stat() on
/net/{NODE_NAME/proc/1 and check st_mtime.

Attached is a C++ project (don’t worry, it doesn’t use any of the wacky
C++ features like iostreams or templates) for the IDE that creates a
“nodetime” command. Use it with “-n node_name” to get node_name’s
current time.


Chris Herborth (cherborth@qnx.com)
Never send a monster to do the work of an evil scientist.