Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions plugins/in_winevtlog/pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,25 +189,27 @@ static int pack_systemtime(struct winevtlog_config *ctx, SYSTEMTIME *st)
CHAR buf[64];
size_t len = 0;
_locale_t locale;
TIME_ZONE_INFORMATION tzi;
DYNAMIC_TIME_ZONE_INFORMATION dtzi;
SYSTEMTIME st_local;

GetTimeZoneInformation(&tzi);
_tzset();

GetDynamicTimeZoneInformation(&dtzi);

locale = _get_current_locale();
if (locale == NULL) {
return -1;
}
if (st != NULL) {
SystemTimeToTzSpecificLocalTime(&tzi, st, &st_local);
SystemTimeToTzSpecificLocalTimeEx(&dtzi, st, &st_local);

struct tm tm = {st_local.wSecond,
st_local.wMinute,
st_local.wHour,
st_local.wDay,
st_local.wMonth-1,
st_local.wYear-1900,
st_local.wDayOfWeek, 0, 0};
st_local.wDayOfWeek, 0, -1};
len = _strftime_l(buf, 64, FORMAT_ISO8601, &tm, locale);
if (len == 0) {
flb_errno();
Expand All @@ -234,6 +236,8 @@ static int pack_filetime(struct winevtlog_config *ctx, ULONGLONG filetime)
SYSTEMTIME st;
_locale_t locale;

_tzset();

locale = _get_current_locale();
if (locale == NULL) {
return -1;
Expand All @@ -243,7 +247,7 @@ static int pack_filetime(struct winevtlog_config *ctx, ULONGLONG filetime)
ft.dwLowDateTime = timestamp.LowPart;
FileTimeToLocalFileTime(&ft, &ft_local);
if (FileTimeToSystemTime(&ft_local, &st)) {
struct tm tm = {st.wSecond, st.wMinute, st.wHour, st.wDay, st.wMonth-1, st.wYear-1900, st.wDayOfWeek, 0, 0};
struct tm tm = {st.wSecond, st.wMinute, st.wHour, st.wDay, st.wMonth-1, st.wYear-1900, st.wDayOfWeek, 0, -1};
len = _strftime_l(buf, 64, FORMAT_ISO8601, &tm, locale);
if (len == 0) {
flb_errno();
Expand Down