Problem
When the "Import events using local server time (not UTC)" option is selected, SQLNexus_PostProcessing.sql unconditionally applied a UTC offset (DATEADD(HOUR, @utc_to_local_offset, ...)) to StartTime and EndTime when populating StartTime_local and EndTime_local in tblBatches, tblStatements, and tblConnections. Because the timestamps written by ReadTrace and TraceEventImporter were already in local server time (via the -B bias flag), applying the offset a second time produced incorrect — and in extreme cases invalid — datetime values.
Two additional gaps compounded the issue:
- SQLNexus_PostProcessing.sql had no mechanism to detect local-time imports. There was no code path to skip the UTC offset conversion; it always applied regardless of how the data was imported.
- Neither importer wrote a flag to signal that timestamps were already local. ReadTraceNexusImporter.WriteLocalTimeFlag() was never called, and TraceEventImporterPlugin had no WriteLocalTimeFlag() implementation at all and did not expose or honor the local server time option.
Root cause
SQLNexus_PostProcessing.sql always applied DATEADD(HOUR, @utc_to_local_offset, StartTime) to populate the _local columns, with no way to distinguish a local-time import from a UTC import. The importers had no way to communicate that the timestamps were already adjusted.
Problem
When the "Import events using local server time (not UTC)" option is selected, SQLNexus_PostProcessing.sql unconditionally applied a UTC offset (DATEADD(HOUR, @utc_to_local_offset, ...)) to StartTime and EndTime when populating StartTime_local and EndTime_local in tblBatches, tblStatements, and tblConnections. Because the timestamps written by ReadTrace and TraceEventImporter were already in local server time (via the -B bias flag), applying the offset a second time produced incorrect — and in extreme cases invalid — datetime values.
Two additional gaps compounded the issue:
Root cause
SQLNexus_PostProcessing.sql always applied DATEADD(HOUR, @utc_to_local_offset, StartTime) to populate the _local columns, with no way to distinguish a local-time import from a UTC import. The importers had no way to communicate that the timestamps were already adjusted.