arpadboda commented on a change in pull request #867:
URL: https://github.com/apache/nifi-minifi-cpp/pull/867#discussion_r468475216



##########
File path: extensions/windows-event-log/ConsumeWindowsEventLog.cpp
##########
@@ -624,6 +624,24 @@ void 
ConsumeWindowsEventLog::putEventRenderFlowFileToSession(const EventRender&
     const std::string& str_;
   };
 
+  DYNAMIC_TIME_ZONE_INFORMATION tzinfo;
+  auto ret = GetDynamicTimeZoneInformation(&tzinfo);
+  std::wstring tzstr;
+  std::string tzbias;
+  bool dst = false;
+  switch (ret) {
+  case TIME_ZONE_ID_UNKNOWN:
+    logger_->log_error("Failed to get timezone information!");
+    break;
+  case TIME_ZONE_ID_DAYLIGHT:
+    tzstr = std::wstring(tzinfo.DaylightName, 32);
+    dst = true;
+  case TIME_ZONE_ID_STANDARD:
+    tzstr = tzstr.empty() ? std::wstring(tzinfo.StandardName, 32) : tzstr;  // 
Use standard timezome name in case there is no daylight name or in case it's 
not DST
+    tzbias = std::to_string(tzinfo.Bias + (dst ? tzinfo.DaylightBias : 0));

Review comment:
       Agreed, good spot, thanks!




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to