add FormatDateTime
This commit is contained in:
parent
98259b5f2c
commit
e62be6c99f
@ -153,4 +153,14 @@ namespace a8
|
|||||||
return std::string(buf);
|
return std::string(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string FormatDateTime(time_t time_val)
|
||||||
|
{
|
||||||
|
struct tm tm_time = {0};
|
||||||
|
localtime_r(&time_val, &tm_time);
|
||||||
|
|
||||||
|
char buff[256];
|
||||||
|
buff[0] = '\0';
|
||||||
|
strftime(buff, a8::ArraySize(buff), "%F %T", &tm_time);
|
||||||
|
return std::string(buff);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -63,6 +63,7 @@ namespace a8
|
|||||||
bool MkDir(const std::string& path);
|
bool MkDir(const std::string& path);
|
||||||
void ForceCreateDir(const std::string& path);
|
void ForceCreateDir(const std::string& path);
|
||||||
std::string GetIpAddress(unsigned long ip_saddr);
|
std::string GetIpAddress(unsigned long ip_saddr);
|
||||||
|
std::string FormatDateTime(time_t time_val);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user