Closed gregee123 closed 6 years ago
Thanks for reporting this. I would rather preserve semantics of tm
structure and do this instead:
diff --git a/zf_log/zf_log.c b/zf_log/zf_log.c
index 9e2a948..712a040 100644
--- a/zf_log/zf_log.c
+++ b/zf_log/zf_log.c
@@ -768,7 +768,7 @@ static void time_callback(struct tm *const tm, unsigned *const msec)
SYSTEMTIME st;
GetLocalTime(&st);
tm->tm_year = st.wYear;
- tm->tm_mon = st.wMonth;
+ tm->tm_mon = st.wMonth - 1;
tm->tm_mday = st.wDay;
tm->tm_wday = st.wDayOfWeek;
tm->tm_hour = st.wHour;
Does this fixes your problem?
Yes.
define _ZF_LOG_MESSAGE_FORMAT_PRINTF_VAL__MONTH ,(unsigned)(tm.tm_mon + 1)
that +1 is incorrect on Windows
same goes for this (not checked)
define _ZF_LOG_MESSAGE_FORMAT_PUT_R__MONTH p = put_uint_r((unsigned)tm.tm_mon + 1, 2, '0', p);
with the way it is it gives me 12-27 not 11-27.
you may wanna add tm->tm_mon++;
somwhere around:
*msec = (unsigned)tv.tv_usec / 1000;
instead.