fix: fix timezone formatting bug

This commit is contained in:
2026-08-15 16:36:09 +02:00
parent af7d096969
commit f7677ac3f1
+12 -7
View File
@@ -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) {
g_bootEpoch = DateToEpoch(Year, Month, Day, Hour, Minute, Second);
int offH = g_tzOffsetMinutes / 60;
int offM = g_tzOffsetMinutes % 60;
if (offM < 0) offM = -offM;
int64_t absoluteOffset = g_tzOffsetMinutes;
char sign = '+';
if (absoluteOffset < 0) {
sign = '-';
absoluteOffset = -absoluteOffset;
}
Kt::KernelLogStream(INFO, "Timekeeping Service") << "Time zone: UTC"
<< (offH >= 0 ? "+" : "") << offH
<< (offM ? ":" : "") << (offM >= 10 ? "" : (offM ? "0" : ""))
<< (offM ? offM : 0);
int offH = (int)(absoluteOffset / 60);
int offM = (int)(absoluteOffset % 60);
auto log = Kt::KernelLogStream(INFO, "Timekeeping Service");
log << "Time zone: UTC" << sign << offH;
if (offM != 0)
log << ":" << (offM < 10 ? "0" : "") << offM;
}
int64_t Timekeeping::GetUnixTimestamp() {