You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2020/08/11 08:15:18 UTC

[GitHub] [nifi-minifi-cpp] szaszm commented on a change in pull request #867: MINIFICPP-1327 - Add timezone information as attribute to flowfiles c…

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



##########
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

Review comment:
       Using the `const CharT*` + `size_t` constructor means that the resulting string will always be of the specified length and may include null characters and other garbage. I think this is not what you wanted here.




----------------------------------------------------------------
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:
users@infra.apache.org