feat: add NTP; fix networking bugs/regressions
This commit is contained in:
1 parent
a288dee7df
commit
d99dab45e5
26 files changed
+809
-47
No files matched your search
@@ -84,6 +84,13 @@ int64_t Timekeeping::GetUnixTimestamp() {
|
||||
return g_bootEpoch + (int64_t)(Timekeeping::GetMilliseconds() / 1000);
|
||||
}
|
||||
|
||||
bool Timekeeping::SetUnixTimestamp(int64_t unixSeconds) {
|
||||
if (unixSeconds < 0 || unixSeconds > 4102444799LL)
|
||||
return false;
|
||||
g_bootEpoch = unixSeconds - (int64_t)(Timekeeping::GetMilliseconds() / 1000);
|
||||
return true;
|
||||
}
|
||||
|
||||
Timekeeping::DateTime Timekeeping::GetDateTime() {
|
||||
return EpochToDate(GetUnixTimestamp() + (int64_t)g_tzOffsetMinutes * 60);
|
||||
}
|
||||
@@ -94,4 +101,4 @@ void Timekeeping::SetTZOffset(int totalMinutes) {
|
||||
|
||||
int Timekeeping::GetTZOffset() {
|
||||
return g_tzOffsetMinutes;
|
||||
}
|
||||
}
|
||||
@@ -53,6 +53,7 @@ namespace Timekeeping {
|
||||
void Init(uint16_t Year, uint8_t Month, uint8_t Day, uint8_t Hour, uint8_t Minute, uint8_t Second);
|
||||
int64_t GetUnixTimestamp();
|
||||
DateTime GetDateTime();
|
||||
bool SetUnixTimestamp(int64_t unixSeconds);
|
||||
|
||||
void SetTZOffset(int totalMinutes);
|
||||
int GetTZOffset();
|
||||
|
||||
Reference in new issue
Block a user