mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-08-23 06:13:07 -06:00
Ide: Logger now display time with miliseconds.
git-svn-id: svn://ultimatepp.org/upp/trunk@11623 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
b9b9586857
commit
c3bcf8e337
1 changed files with 14 additions and 2 deletions
|
|
@ -1,5 +1,7 @@
|
|||
#include "Logger.h"
|
||||
|
||||
#include <chrono>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
Logger::Logger(LoggingLevel level, const String& tag)
|
||||
|
|
@ -34,8 +36,18 @@ void Logger::Log()
|
|||
|
||||
String Logger::GetCurrentTime()
|
||||
{
|
||||
Time tm = GetSysTime();
|
||||
return Format("%02d:%02d:%02d", (int)tm.hour, (int)tm.minute, (int)tm.second);
|
||||
using namespace std::chrono;
|
||||
using days = duration<int, std::ratio_multiply<hours::period, std::ratio<24>>::type>;
|
||||
|
||||
auto tp = system_clock::now().time_since_epoch();
|
||||
|
||||
auto d = duration_cast<days>(tp); tp -= d;
|
||||
auto h = duration_cast<hours>(tp); tp -= h;
|
||||
auto m = duration_cast<minutes>(tp); tp -= m;
|
||||
auto s = duration_cast<seconds>(tp); tp -= s;
|
||||
auto ms = duration_cast<milliseconds>(tp);
|
||||
|
||||
return Format("%02d:%02d:%02d:%03d", (int)h.count(), (int)m.count(), (int)s.count(), (int)ms.count());
|
||||
}
|
||||
|
||||
Stream& Upp::operator<<(Stream& s, Logger::LoggingLevel level)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue