aboutsummaryrefslogtreecommitdiff
path: root/src/common/Utilities/Util.cpp
diff options
context:
space:
mode:
authorjackpoz <giacomopoz@gmail.com>2019-04-19 23:45:07 +0200
committerShauren <shauren.trinity@gmail.com>2021-12-01 00:46:05 +0100
commit5600316c9f69d2afda82ae0e632715b420dfd402 (patch)
tree69916db003c4e4b622977f76695f6bf2ecfb41c4 /src/common/Utilities/Util.cpp
parentaeaca00d76d0fdaee6d21050a1fadcf1f0543358 (diff)
Core/Calendar: Improve calendar timezone handling
Improve calendar timezone handling by at least creating events with the correct time if both client and server are in the same timezone. There is currently no information received from the client about in which timezone it is. (cherry picked from commit b33934f6ce9b0227597c712dd6a76b7ed49deea3)
Diffstat (limited to 'src/common/Utilities/Util.cpp')
-rw-r--r--src/common/Utilities/Util.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/common/Utilities/Util.cpp b/src/common/Utilities/Util.cpp
index f787edd13ea..5123636f6a0 100644
--- a/src/common/Utilities/Util.cpp
+++ b/src/common/Utilities/Util.cpp
@@ -77,6 +77,15 @@ struct tm* localtime_r(time_t const* time, struct tm *result)
}
#endif
+time_t LocalTimeToUTCTime(time_t time)
+{
+#if (defined(WIN32) || defined(_WIN32) || defined(__WIN32__))
+ return time + _timezone;
+#else
+ return time + timezone;
+#endif
+}
+
std::string secsToTimeString(uint64 timeInSecs, bool shortText, bool hoursOnly)
{
uint64 secs = timeInSecs % MINUTE;