Skip to content

Commit

Permalink
fix uint64 constant suffix on MinGW . thanks @wuqi from http://stacko…
Browse files Browse the repository at this point in the history
  • Loading branch information
zsummer committed Nov 15, 2014
1 parent ca02f27 commit dfaf4c6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions log4z.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1239,7 +1239,7 @@ bool CLogerManager::PushLog(LoggerId id, int level, const char * log)
now <<= 32;
now |= ft.dwLowDateTime;
now /=10;
now -=11644473600000000Ui64;
now -=11644473600000000ULL;
now /=1000;
pLog->_time = now/1000;
pLog->_precise = (unsigned int)(now%1000);
Expand All @@ -1253,17 +1253,17 @@ bool CLogerManager::PushLog(LoggerId id, int level, const char * log)
{
tm tt = TimeToTm(pLog->_time);
#ifdef WIN32
int ret = _snprintf_s(pLog->_content, LOG4Z_LOG_BUF_SIZE, _TRUNCATE, "%d-%02d-%02d %02d:%02d:%02d.%03d %s %s \r\n",
tt.tm_year + 1900, tt.tm_mon + 1, tt.tm_mday, tt.tm_hour, tt.tm_min, tt.tm_sec, pLog->_precise,
int ret = _snprintf_s(pLog->_content, LOG4Z_LOG_BUF_SIZE, _TRUNCATE, "%d-%02d-%02d %02d:%02d:%02d.%03d %s %s \r\n",
tt.tm_year + 1900, tt.tm_mon + 1, tt.tm_mday, tt.tm_hour, tt.tm_min, tt.tm_sec, pLog->_precise,
LOG_STRING[pLog->_level], log);
if (ret == -1)
{
ret = LOG4Z_LOG_BUF_SIZE - 1;
}
pLog->_contentLen = ret;
#else
int ret = snprintf(pLog->_content, LOG4Z_LOG_BUF_SIZE, "%d-%02d-%02d %02d:%02d:%02d.%03d %s %s \r\n",
tt.tm_year + 1900, tt.tm_mon + 1, tt.tm_mday, tt.tm_hour, tt.tm_min, tt.tm_sec, pLog->_precise,
int ret = snprintf(pLog->_content, LOG4Z_LOG_BUF_SIZE, "%d-%02d-%02d %02d:%02d:%02d.%03d %s %s \r\n",
tt.tm_year + 1900, tt.tm_mon + 1, tt.tm_mday, tt.tm_hour, tt.tm_min, tt.tm_sec, pLog->_precise,
LOG_STRING[pLog->_level], log);
if (ret == -1)
{
Expand Down

0 comments on commit dfaf4c6

Please sign in to comment.