2012-10-22 22:45:18 +00:00
|
|
|
#ifdef NALL_STRING_INTERNAL_HPP
|
|
|
|
|
|
|
|
namespace nall {
|
|
|
|
|
|
|
|
string string::date() {
|
2013-03-15 13:11:33 +00:00
|
|
|
time_t timestamp = ::time(nullptr);
|
2013-05-02 11:25:45 +00:00
|
|
|
tm* info = localtime(×tamp);
|
2012-10-22 22:45:18 +00:00
|
|
|
return {
|
2013-05-05 09:21:30 +00:00
|
|
|
format<4, '0'>(1900 + info->tm_year), "-",
|
|
|
|
format<2, '0'>(1 + info->tm_mon), "-",
|
|
|
|
format<2, '0'>(info->tm_mday)
|
2012-10-22 22:45:18 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
string string::time() {
|
2013-03-15 13:11:33 +00:00
|
|
|
time_t timestamp = ::time(nullptr);
|
2013-05-02 11:25:45 +00:00
|
|
|
tm* info = localtime(×tamp);
|
2012-10-22 22:45:18 +00:00
|
|
|
return {
|
2013-05-05 09:21:30 +00:00
|
|
|
format<2, '0'>(info->tm_hour), ":",
|
|
|
|
format<2, '0'>(info->tm_min), ":",
|
|
|
|
format<2, '0'>(info->tm_sec)
|
2012-10-22 22:45:18 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
string string::datetime() {
|
|
|
|
return {string::date(), " ", string::time()};
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|