2021-04-14 05:34:15 +00:00
|
|
|
#include "DateTime.h"
|
2016-02-24 06:59:29 +00:00
|
|
|
#include <time.h>
|
|
|
|
|
|
|
|
CDateTime::CDateTime()
|
|
|
|
{
|
2021-04-12 11:35:39 +00:00
|
|
|
m_time = time(nullptr);
|
2016-02-24 06:59:29 +00:00
|
|
|
}
|
|
|
|
|
2016-08-10 10:03:25 +00:00
|
|
|
std::string CDateTime::Format(const char * format)
|
2016-02-24 06:59:29 +00:00
|
|
|
{
|
|
|
|
char buffer[100];
|
2016-09-16 21:37:27 +00:00
|
|
|
strftime(buffer, sizeof(buffer), format, localtime(&m_time));
|
2016-02-24 06:59:29 +00:00
|
|
|
return std::string(buffer);
|
|
|
|
}
|
2016-12-13 06:31:40 +00:00
|
|
|
|
|
|
|
CDateTime & CDateTime::SetToNow(void)
|
|
|
|
{
|
2021-04-12 11:35:39 +00:00
|
|
|
m_time = time(nullptr);
|
2016-12-13 06:31:40 +00:00
|
|
|
return *this;
|
|
|
|
}
|