File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -109,6 +109,26 @@ log_overhead() {
109109 fi
110110}
111111
112+ check_wsl2_time_sync () {
113+ # Check if running on WSL2
114+ if grep -qEi " (Microsoft|WSL)" /proc/version & > /dev/null; then
115+ log_info " WSL2 detected - checking system time synchronization..."
116+
117+ # Try to sync hardware clock to system time (requires sudo)
118+ if command -v hwclock & > /dev/null; then
119+ if sudo -n hwclock -s & > /dev/null 2>&1 ; then
120+ log_success " System time synchronized with hardware clock"
121+ else
122+ log_warning " Could not sync hardware clock (sudo required)"
123+ log_info " To fix clock skew issues, run: sudo hwclock -s"
124+ log_info " Continuing anyway - some timing measurements may show warnings"
125+ fi
126+ else
127+ log_info " hwclock not available - skipping time sync"
128+ fi
129+ fi
130+ }
131+
112132# Check server connectivity
113133check_server () {
114134 log_info " Checking server connectivity at ${BASE_URL} ..."
@@ -1875,6 +1895,7 @@ main() {
18751895 echo " "
18761896
18771897 # Setup
1898+ check_wsl2_time_sync
18781899 check_server
18791900 get_auth_token
18801901 warmup_system
Original file line number Diff line number Diff line change @@ -117,6 +117,26 @@ log_warning() {
117117 echo -e " ${YELLOW} [WARN]${NC} $1 "
118118}
119119
120+ check_wsl2_time_sync () {
121+ # Check if running on WSL2
122+ if grep -qEi " (Microsoft|WSL)" /proc/version & > /dev/null; then
123+ log_info " WSL2 detected - checking system time synchronization..."
124+
125+ # Try to sync hardware clock to system time (requires sudo)
126+ if command -v hwclock & > /dev/null; then
127+ if sudo -n hwclock -s & > /dev/null 2>&1 ; then
128+ log_success " System time synchronized with hardware clock"
129+ else
130+ log_warning " Could not sync hardware clock (sudo required)"
131+ log_info " To fix clock skew issues, run: sudo hwclock -s"
132+ log_info " Continuing anyway - some timing measurements may show warnings"
133+ fi
134+ else
135+ log_info " hwclock not available - skipping time sync"
136+ fi
137+ fi
138+ }
139+
120140check_server () {
121141 log_info " Checking server connectivity at ${BASE_URL} ..."
122142 if ! curl -s -f " ${BASE_URL} " > /dev/null 2>&1 ; then
@@ -1475,6 +1495,7 @@ main() {
14751495
14761496 # Phase 1: Pre-flight & Authentication
14771497 log_header " Phase 1: Pre-flight & Authentication"
1498+ check_wsl2_time_sync
14781499 check_server
14791500 get_auth_token
14801501
You can’t perform that action at this time.
0 commit comments