diff --git a/AerofoilPortable/GpSystemServices_POSIX.cpp b/AerofoilPortable/GpSystemServices_POSIX.cpp index 1566a4f..15bcb55 100644 --- a/AerofoilPortable/GpSystemServices_POSIX.cpp +++ b/AerofoilPortable/GpSystemServices_POSIX.cpp @@ -17,7 +17,7 @@ GpSystemServices_POSIX::GpSystemServices_POSIX() int64_t GpSystemServices_POSIX::GetTime() const { time_t t = time(nullptr); - return static_cast(t) - 2082844800; + return static_cast(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 diff --git a/MakeTimestamp/MakeTimestamp.cpp b/MakeTimestamp/MakeTimestamp.cpp index 58694d8..1e82169 100644 --- a/MakeTimestamp/MakeTimestamp.cpp +++ b/MakeTimestamp/MakeTimestamp.cpp @@ -71,7 +71,7 @@ int main(int argc, const char **argv) } PortabilityLayer::CombinedTimestamp ts; - ts.SetMacEpochTime(currentTimeUnix + ts.kMacEpochToUTC); + ts.SetMacEpochTime(static_cast(currentTimeUnix) - ts.kMacEpochToUTC); ts.SetLocalYear(currentTimeStruct->tm_year + 1900); ts.m_localMonth = currentTimeStruct->tm_mon + 1; diff --git a/PortabilityLayer/CombinedTimestamp.h b/PortabilityLayer/CombinedTimestamp.h index 85ea457..7766e6f 100644 --- a/PortabilityLayer/CombinedTimestamp.h +++ b/PortabilityLayer/CombinedTimestamp.h @@ -18,7 +18,7 @@ namespace PortabilityLayer uint8_t m_padding[3]; - static const int32_t kMacEpochToUTC = 2082844800; + static const int32_t kMacEpochToUTC = -2082844800; int64_t GetMacEpochTime() const; void SetMacEpochTime(int64_t timestamp);