clock.py 275 B

123456789101112
  1. import socket, datetime
  2. now = datetime.datetime.now()
  3. since_midnight = (
  4. now -
  5. now.replace(hour=0, minute=0, second=0)
  6. ).seconds
  7. sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
  8. sock.sendto('analogclock/clock/set:%d' % since_midnight, ('127.0.0.1', 4444))