Files
bsnes/nall/string/datetime.hpp
Tim Allen 78d49d3873 Update to v095r10 release.
byuu says:

Changelog:

- int_t<bits> replaced with Integer<bits>
- uint_t<bits> replaced with Natural<bits>
- fixed "Synchronize Audio" menu option that broke recently
- all of sfc/performance ported to "auto function() -> return;" syntax

With this WIP, all of higan is finally ported over to the new function
declaration syntax. Thank the gods.

There's still going to be periodic disruption for diffs from porting
over signed->int, unsigned->uint, and whatever we come up with for the
new Natural<> and Integer<> classes. But the worst of it's behind us
now.
2015-12-07 08:11:41 +11:00

33 lines
792 B
C++

#ifdef NALL_STRING_INTERNAL_HPP
namespace nall {
auto string::date(time_t timestamp) -> string {
if(timestamp == 0) timestamp = ::time(nullptr);
tm* info = localtime(&timestamp);
return {
nall::natural(1900 + info->tm_year, 4L), "-",
nall::natural(1 + info->tm_mon, 2L), "-",
nall::natural(info->tm_mday, 2L)
};
}
auto string::time(time_t timestamp) -> string {
if(timestamp == 0) timestamp = ::time(nullptr);
tm* info = localtime(&timestamp);
return {
nall::natural(info->tm_hour, 2L), ":",
nall::natural(info->tm_min, 2L), ":",
nall::natural(info->tm_sec, 2L)
};
}
auto string::datetime(time_t timestamp) -> string {
if(timestamp == 0) timestamp = ::time(nullptr);
return {string::date(timestamp), " ", string::time(timestamp)};
}
}
#endif