pyztk/example/sync_time.py
2019-04-25 16:40:15 +07:00

24 lines
471 B
Python

# -*- coding: utf-8 -*-
import os
import sys
from datetime import datetime
CWD = os.path.dirname(os.path.realpath(__file__))
ROOT_DIR = os.path.dirname(CWD)
sys.path.append(ROOT_DIR)
from zk import ZK, const
conn = None
zk = ZK('192.168.2.201', port=4370)
try:
conn = zk.connect()
print ("Syncing time...")
conn.set_time(datetime.now())
except Exception as e:
print ("Process terminate : {}".format(e))
finally:
if conn:
conn.disconnect()