How do I get the system time of another system on the same network?

I know how to get the current system date and time using datetime in python. Is there a way to get the date and time of another system on the same network using python language? I searched for it a lot but didn't find anything useful. Basically, I am using beaglebone black (using usb ethernet connection with host) to implement a traffic shaping system. Using datetime, the program returns the beaglebone time. I want the host system time instead. How can i do this?

+3


source to share


1 answer


Here is the solution, make sure the client computer is allowed to enter the destination computer without entering a password,
python code:

import os

remote_date = os.popen("ssh user@yourhost date").readline()
print remote_date

      



Output:
Thu Jan 1 13:33:48 CST 2015

might be useful to you :)

+4


source







All Articles