[*] Clean up
This commit is contained in:
parent
e1e1da8e1b
commit
6afe6c7342
@ -126,4 +126,4 @@ namespace Aurora::Logging::Sinks
|
|||||||
{
|
{
|
||||||
AuSafeDelete< EventLogSink *>(sink);
|
AuSafeDelete< EventLogSink *>(sink);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -198,25 +198,25 @@ namespace Aurora::Time
|
|||||||
|
|
||||||
AUKN_SYM tm ToCivilTime(AuInt64 time, bool UTC)
|
AUKN_SYM tm ToCivilTime(AuInt64 time, bool UTC)
|
||||||
{
|
{
|
||||||
std::tm ret{};
|
std::tm ret {};
|
||||||
auto timet = MSToCTime(time);
|
auto timet = MSToCTime(time);
|
||||||
if (UTC)
|
if (UTC)
|
||||||
{
|
{
|
||||||
#if defined(AURORA_COMPILER_MSVC)
|
#if defined(AURORA_COMPILER_MSVC)
|
||||||
auto tm = gmtime_s(&ret, &timet);
|
auto tm = gmtime_s(&ret, &timet);
|
||||||
#else
|
#else
|
||||||
auto tm = gmtime_r(&timet, &ret);
|
auto tm = gmtime_r(&timet, &ret);
|
||||||
#endif
|
#endif
|
||||||
#if defined(AURORA_COMPILER_MSVC)
|
#if defined(AURORA_COMPILER_MSVC)
|
||||||
SysAssert(!tm, "couldn't convert civil time");
|
SysAssert(!tm, "couldn't convert civil time");
|
||||||
#else
|
#else
|
||||||
SysAssert(tm, "couldn't convert civil time");
|
SysAssert(tm, "couldn't convert civil time");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if defined(AURORA_COMPILER_MSVC)
|
#if defined(AURORA_COMPILER_MSVC)
|
||||||
if (localtime_s(&ret, &timet))
|
if (localtime_s(&ret, &timet))
|
||||||
#else
|
#else
|
||||||
if (!localtime_r(&timet, &ret))
|
if (!localtime_r(&timet, &ret))
|
||||||
@ -235,7 +235,7 @@ namespace Aurora::Time
|
|||||||
{
|
{
|
||||||
::tm tm;
|
::tm tm;
|
||||||
time_t timet;
|
time_t timet;
|
||||||
|
|
||||||
time.CopyTo(tm);
|
time.CopyTo(tm);
|
||||||
|
|
||||||
if (UTC)
|
if (UTC)
|
||||||
@ -248,12 +248,12 @@ namespace Aurora::Time
|
|||||||
tm.tm_isdst = -1; // out of the 2 crts i've bothered to check, out of 3, this is legal
|
tm.tm_isdst = -1; // out of the 2 crts i've bothered to check, out of 3, this is legal
|
||||||
timet = mktime(&tm);
|
timet = mktime(&tm);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((timet == 0) || (timet == -1))
|
if ((timet == 0) || (timet == -1))
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return std::chrono::duration_cast<std::chrono::milliseconds>(NormalizeEpoch(std::chrono::system_clock::from_time_t(timet).time_since_epoch())).count();
|
return std::chrono::duration_cast<std::chrono::milliseconds>(NormalizeEpoch(std::chrono::system_clock::from_time_t(timet).time_since_epoch())).count();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -266,4 +266,4 @@ namespace Aurora::Time
|
|||||||
|
|
||||||
return ToCivilTime(FromCivilTime(time, shift == ETimezoneShift::eUTC));
|
return ToCivilTime(FromCivilTime(time, shift == ETimezoneShift::eUTC));
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user