mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-12-14 12:09:36 +00:00
Fix broken timestamps
This commit is contained in:
@@ -17,7 +17,7 @@ GpSystemServices_POSIX::GpSystemServices_POSIX()
|
|||||||
int64_t GpSystemServices_POSIX::GetTime() const
|
int64_t GpSystemServices_POSIX::GetTime() const
|
||||||
{
|
{
|
||||||
time_t t = time(nullptr);
|
time_t t = time(nullptr);
|
||||||
return static_cast<int64_t>(t) - 2082844800;
|
return static_cast<int64_t>(t) + 2082844800;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GpSystemServices_POSIX::GetLocalDateTime(unsigned int &year, unsigned int &month, unsigned int &day, unsigned int &hour, unsigned int &minute, unsigned int &second) const
|
void GpSystemServices_POSIX::GetLocalDateTime(unsigned int &year, unsigned int &month, unsigned int &day, unsigned int &hour, unsigned int &minute, unsigned int &second) const
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ int main(int argc, const char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
PortabilityLayer::CombinedTimestamp ts;
|
PortabilityLayer::CombinedTimestamp ts;
|
||||||
ts.SetMacEpochTime(currentTimeUnix + ts.kMacEpochToUTC);
|
ts.SetMacEpochTime(static_cast<int64_t>(currentTimeUnix) - ts.kMacEpochToUTC);
|
||||||
|
|
||||||
ts.SetLocalYear(currentTimeStruct->tm_year + 1900);
|
ts.SetLocalYear(currentTimeStruct->tm_year + 1900);
|
||||||
ts.m_localMonth = currentTimeStruct->tm_mon + 1;
|
ts.m_localMonth = currentTimeStruct->tm_mon + 1;
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ namespace PortabilityLayer
|
|||||||
|
|
||||||
uint8_t m_padding[3];
|
uint8_t m_padding[3];
|
||||||
|
|
||||||
static const int32_t kMacEpochToUTC = 2082844800;
|
static const int32_t kMacEpochToUTC = -2082844800;
|
||||||
|
|
||||||
int64_t GetMacEpochTime() const;
|
int64_t GetMacEpochTime() const;
|
||||||
void SetMacEpochTime(int64_t timestamp);
|
void SetMacEpochTime(int64_t timestamp);
|
||||||
|
|||||||
Reference in New Issue
Block a user