d959306719630883f44221c5642ca22885b26d59
Implemented Windows high-resolution timing mocks for deterministic simulation: **mock_QueryPerformanceCounter:** - Returns deterministic counter based on simulated_time - Uses fixed 10 MHz frequency (10,000,000 counts/second) - Calculation: count = (tv_sec * freq) + (tv_nsec * freq / 1e9) - Validates NULL pointer with ERROR_INVALID_PARAMETER - Provides consistent, reproducible timing across test runs **mock_QueryPerformanceFrequency:** - Returns fixed frequency of 10 MHz (10,000,000 Hz) - Common frequency on modern Windows systems - Ensures deterministic behavior (no variation between runs) - Validates NULL pointer with ERROR_INVALID_PARAMETER **Integration:** - Added function declarations to system.h - Macros already existed (sys_QueryPerformanceCounter/Frequency) - Complements existing mock_clock_gettime on Linux - Both platforms now have deterministic high-resolution timing This ensures Windows code using QueryPerformanceCounter for timing, benchmarking, or rate limiting behaves deterministically in tests. The fixed 10 MHz frequency provides nanosecond-level precision (100ns per tick) suitable for most timing needs.
Languages
C
98.4%
Shell
1%
Zig
0.4%
Batchfile
0.2%