fix: fix timezone formatting bug
This commit is contained in:
@@ -70,14 +70,19 @@ static Timekeeping::DateTime EpochToDate(int64_t epoch) {
|
|||||||
void Timekeeping::Init(uint16_t Year, uint8_t Month, uint8_t Day, uint8_t Hour, uint8_t Minute, uint8_t Second) {
|
void Timekeeping::Init(uint16_t Year, uint8_t Month, uint8_t Day, uint8_t Hour, uint8_t Minute, uint8_t Second) {
|
||||||
g_bootEpoch = DateToEpoch(Year, Month, Day, Hour, Minute, Second);
|
g_bootEpoch = DateToEpoch(Year, Month, Day, Hour, Minute, Second);
|
||||||
|
|
||||||
int offH = g_tzOffsetMinutes / 60;
|
int64_t absoluteOffset = g_tzOffsetMinutes;
|
||||||
int offM = g_tzOffsetMinutes % 60;
|
char sign = '+';
|
||||||
if (offM < 0) offM = -offM;
|
if (absoluteOffset < 0) {
|
||||||
|
sign = '-';
|
||||||
|
absoluteOffset = -absoluteOffset;
|
||||||
|
}
|
||||||
|
|
||||||
Kt::KernelLogStream(INFO, "Timekeeping Service") << "Time zone: UTC"
|
int offH = (int)(absoluteOffset / 60);
|
||||||
<< (offH >= 0 ? "+" : "") << offH
|
int offM = (int)(absoluteOffset % 60);
|
||||||
<< (offM ? ":" : "") << (offM >= 10 ? "" : (offM ? "0" : ""))
|
auto log = Kt::KernelLogStream(INFO, "Timekeeping Service");
|
||||||
<< (offM ? offM : 0);
|
log << "Time zone: UTC" << sign << offH;
|
||||||
|
if (offM != 0)
|
||||||
|
log << ":" << (offM < 10 ? "0" : "") << offM;
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t Timekeeping::GetUnixTimestamp() {
|
int64_t Timekeeping::GetUnixTimestamp() {
|
||||||
|
|||||||
Reference in New Issue
Block a user