소스 검색

Merge pull request #274 from nickbabcock/time-zome

Fix pg insertion failure due to time zones
Nick Babcock 3 년 전
부모
커밋
d82b03cff4
1개의 변경된 파일4개의 추가작업 그리고 0개의 파일을 삭제
  1. 4 0
      OhmGraphite/TimescaleWriter.cs

+ 4 - 0
OhmGraphite/TimescaleWriter.cs

@@ -30,6 +30,10 @@ namespace OhmGraphite
         {
             try
             {
+                // "timestamp with time zone" postgres type is a UTC timestamp so
+                // we explicitly convert the reported time to UTC to avoid a cast
+                // exception by npgsql
+                reportTime = reportTime.ToUniversalTime();
                 if (_failure)
                 {
                     Logger.Debug("Clearing connection pool");