Last active
August 29, 2015 14:25
-
-
Save HarryCoops/fc3a6b9c1337a7eac7c5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import ntplib | |
def get_time(): | |
'''Get atomic time from server and return it, along with the offset.''' | |
c = ntplib.NTPClient() | |
response = c.request('uk.pool.ntp.org', version=3) | |
return time.ctime(response.tx_time), response.offset | |
def main(): | |
atom_time = get_time() | |
print('Atomic time:', atom_time[0]) | |
print('Offset: ', atom_time[1]) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment