project64/Source/Common/DateTime.cpp

21 lines
361 B
C++
Raw Normal View History

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
}
std::string CDateTime::Format(const char * format)
2016-02-24 06:59:29 +00:00
{
char buffer[100];
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;
}