获取网络上机器的当前系统时间

SIn*_*dhu 7 python time networking system

我知道我可以像这样查询我的机器的系统时间:

from datetime import datetime
datetime.now()
Run Code Online (Sandbox Code Playgroud)

有没有办法查询Windows网络上另一台机器的系统时间?例如\\mynetworkpc.

ani*_*haw 5

在Windows机器上有net time \\<remote-ip address>获取远程机器的时间,但我不知道它是否可移植.

>>> import subprocess
>>> subprocess.call(r"net time \\172.21.5.135")
Current time at \\172.21.5.135 is 10/18/2010 12:32 PM

The command completed successfully.

0
>>>
Run Code Online (Sandbox Code Playgroud)