From 3de1549e9b1ee623de6b2914001ce2939f8ebd1c Mon Sep 17 00:00:00 2001 From: Erik Darling <2136037+erikdarlingdata@users.noreply.github.com> Date: Fri, 20 Feb 2026 06:49:53 -0500 Subject: [PATCH] Fix NOC deadlock/blocking showing "just now" for stale events (fixes #187) Extended Events timestamps are UTC but the NOC queries used SYSDATETIME() (local time). On a UTC-8 server, DATEDIFF returned -480 for recent events, which FormatMinutesAgo treated as "just now". Changed to SYSUTCDATETIME(). Co-Authored-By: Claude Opus 4.6 --- Dashboard/Services/DatabaseService.NocHealth.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dashboard/Services/DatabaseService.NocHealth.cs b/Dashboard/Services/DatabaseService.NocHealth.cs index 33a68263..e5125e3d 100644 --- a/Dashboard/Services/DatabaseService.NocHealth.cs +++ b/Dashboard/Services/DatabaseService.NocHealth.cs @@ -505,7 +505,7 @@ private async Task GetLastBlockingEventTimeAsync(SqlConnection connection, Serve SELECT TOP (1) minutes_ago = - DATEDIFF(MINUTE, bpx.event_time, SYSDATETIME()) + DATEDIFF(MINUTE, bpx.event_time, SYSUTCDATETIME()) FROM collect.blocked_process_xml AS bpx ORDER BY bpx.id DESC @@ -530,7 +530,7 @@ private async Task GetLastDeadlockEventTimeAsync(SqlConnection connection, Serve SELECT TOP (1) minutes_ago = - DATEDIFF(MINUTE, dx.event_time, SYSDATETIME()) + DATEDIFF(MINUTE, dx.event_time, SYSUTCDATETIME()) FROM collect.deadlock_xml AS dx ORDER BY dx.id DESC