diff --git a/pupil_src/shared_modules/network_time_sync.py b/pupil_src/shared_modules/network_time_sync.py index 41b0982367..8f4b9e5cb7 100644 --- a/pupil_src/shared_modules/network_time_sync.py +++ b/pupil_src/shared_modules/network_time_sync.py @@ -13,6 +13,7 @@ import socket import threading import asyncore +import struct from random import random import logging @@ -44,9 +45,10 @@ def __init__(self, sock, time_fn): asyncore.dispatcher_with_send.__init__(self, sock) def handle_read(self): - data = self.recv(1024) + # expecting `sync` message + data = self.recv(4) if data: - self.send(repr(self.time_fn()).encode()) + self.send(struct.pack('