07 EVS Time Sync
📋 Introduction
EVS Time Sync is a high-precision time synchronization solution based on UDP protocol, designed for multi-device event camera systems. Through heartbeat mechanism and offset calculation, it ensures that the timestamps of all devices remain consistent, achieving microsecond-level time synchronization accuracy.
📋 Technical Specifications
System Requirements
- Operating System: Ubuntu 22.04 / CentOS / RHEL
- Build Tools: gcc, g++, build-essential
- Network Protocol: UDP
- Default Port: 9999 (Configurable)
Protocol Specification
- Protocol File:
time_sync_protocol.h - Protocol Version: 1
- Magic Number: 0x54535943 ("TSYNC")
- Synchronization Accuracy: Microsecond level
🔧 Dependency Description
- Essential Dependencies: gcc, g++, pthread, librt (Usually included in system)
- Network Library: Standard socket library
🚀 Quick Start
Compile Server Side (PC Side)
# Compile time synchronization server
make timesync
# Compilation result: generate time_sync_server executable fileRun Time Synchronization Server on PC
# Run time synchronization server (default port 9999)
./time_sync_server
# Or specify port
./time_sync_server 10000Program running screenshot 
Clean Build Files
# Clean time synchronization related build files
make clean_timesync📡 Communication Protocol
Message Types
1. Heartbeat Message (Device → Server)
Message Type: TIME_SYNC_MSG_HEARTBEAT = 1
Structure:
typedef struct {
TimeSyncMsgHeader_t header;
uint64_t timestamp_us; // Device current timestamp (microseconds)
uint32_t sequence; // Sequence number
} TimeSyncHeartbeatMsg_t;Sending Frequency: Once per second
2. Offset Reply (Server → Device)
Message Type: TIME_SYNC_MSG_OFFSET_REPLY = 2
Structure:
typedef struct {
TimeSyncMsgHeader_t header;
int64_t offset_us; // Recommended time offset (microseconds)
uint32_t reference_device_id; // Reference device ID
uint32_t sync_quality; // Synchronization quality (0-100)
uint32_t sequence; // Corresponding heartbeat sequence number
} TimeSyncOffsetReplyMsg_t;Sending Timing: Reply immediately after receiving heartbeat
3. Status Query/Reply (Optional)
Message Type:
