fix(Core/Misc): GCC warnings (#3428)
This commit is contained in:
parent
0c2dce03cc
commit
fa6f814eba
2 changed files with 14 additions and 2 deletions
|
|
@ -348,7 +348,13 @@ std::string Log::GetTimestampStr()
|
|||
// MM minutes (2 digits 00-59)
|
||||
// SS seconds (2 digits 00-59)
|
||||
char buf[20];
|
||||
snprintf(buf, 20, "%04d-%02d-%02d_%02d-%02d-%02d", aTm.tm_year+1900, aTm.tm_mon+1, aTm.tm_mday, aTm.tm_hour, aTm.tm_min, aTm.tm_sec);
|
||||
int ret = snprintf(buf, 20, "%04d-%02d-%02d_%02d-%02d-%02d", aTm.tm_year+1900, aTm.tm_mon+1, aTm.tm_mday, aTm.tm_hour, aTm.tm_min, aTm.tm_sec);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
return std::string("ERROR");
|
||||
}
|
||||
|
||||
return std::string(buf);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -235,7 +235,13 @@ std::string TimeToTimestampStr(time_t t)
|
|||
// MM minutes (2 digits 00-59)
|
||||
// SS seconds (2 digits 00-59)
|
||||
char buf[20];
|
||||
snprintf(buf, 20, "%04d-%02d-%02d_%02d-%02d-%02d", aTm.tm_year+1900, aTm.tm_mon+1, aTm.tm_mday, aTm.tm_hour, aTm.tm_min, aTm.tm_sec);
|
||||
int ret = snprintf(buf, 20, "%04d-%02d-%02d_%02d-%02d-%02d", aTm.tm_year+1900, aTm.tm_mon+1, aTm.tm_mday, aTm.tm_hour, aTm.tm_min, aTm.tm_sec);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
return std::string("ERROR");
|
||||
}
|
||||
|
||||
return std::string(buf);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue