File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -516,6 +516,13 @@ perform_write_operation() {
516516 local time=$(( end - start))
517517 local response_body=$( echo " $response " | head -n-1)
518518
519+ # Validate timing (protect against clock skew/adjustment)
520+ if [ " $time " -lt 0 ]; then
521+ # Clock went backward during operation - treat as failure
522+ echo " -1|000|clock_skew"
523+ return
524+ fi
525+
519526 # Check for success codes
520527 local success=0
521528 if [ " $endpoint " = " create" ] && [ " $http_code " = " 201" ]; then
Original file line number Diff line number Diff line change @@ -216,6 +216,14 @@ measure_endpoint() {
216216 local time=$(( end - start))
217217 local http_code=$( echo " $response " | tail -n1)
218218
219+ # Validate timing (protect against clock skew/adjustment)
220+ if [ " $time " -lt 0 ]; then
221+ # Clock went backward during operation - treat as timeout
222+ http_code=" 000"
223+ time=0
224+ echo " [WARN] Clock skew detected (negative timing) for $endpoint " >&2
225+ fi
226+
219227 # Handle curl failure (connection timeout, etc)
220228 if [ -z " $http_code " ] || [ " $http_code " == " 000" ]; then
221229 http_code=" 000"
@@ -534,6 +542,13 @@ perform_write_operation() {
534542 local time=$(( end - start))
535543 local response_body=$( echo " $response " | head -n-1)
536544
545+ # Validate timing (protect against clock skew/adjustment)
546+ if [ " $time " -lt 0 ]; then
547+ # Clock went backward during operation - treat as failure
548+ echo " -1|000|clock_skew"
549+ return
550+ fi
551+
537552 # Check for success codes
538553 local success=0
539554 if [ " $endpoint " = " create" ] && [ " $http_code " = " 201" ]; then
You can’t perform that action at this time.
0 commit comments