enhanced log_write for win32 a bit

This commit is contained in:
hyunghwan.chung 2018-10-14 10:30:52 +00:00
parent d44b400c4a
commit ab8716f7ab

View File

@ -721,7 +721,19 @@ static void log_write (moo_t* moo, moo_bitmask_t mask, const moo_ooch_t* msg, mo
struct tm tm, *tmp; struct tm tm, *tmp;
now = time(NULL); now = time(NULL);
#if defined(_WIN32) || defined(__DOS__) #if defined(_WIN32)
tmp = localtime(&now);
tslen = strftime(ts, sizeof(ts), "%Y-%m-%d %H:%M:%S %z ", tmp);
if (tslen == 0)
{
tslen = strftime(ts, sizeof(ts), "%Y-%m-%d %H:%M:%S ", tmp);
if (tslen == 0)
{
strcpy (ts, "0000-00-00 00:00:00 +0000 ");
tslen = 26;
}
}
#elif defined(__DOS__)
tmp = localtime(&now); tmp = localtime(&now);
tslen = strftime(ts, sizeof(ts), "%Y-%m-%d %H:%M:%S ", tmp); /* no timezone info */ tslen = strftime(ts, sizeof(ts), "%Y-%m-%d %H:%M:%S ", tmp); /* no timezone info */
if (tslen == 0) if (tslen == 0)