diff options
author | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2021-06-27 07:32:39 +0200 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2021-06-27 07:32:39 +0200 |
commit | 66fdcd86c7de338563e5da1477481a940ab3bd52 (patch) | |
tree | c52cf7026599e68b10c533f568b132864e8573c4 /src/locations.cpp | |
parent | b0d110bac6f1f10a949abb7f985ea4becda75488 (diff) | |
parent | 17aa86ab53e3e49cd47116f9640c89484167abcd (diff) | |
download | ayatana-indicator-datetime-66fdcd86c7de338563e5da1477481a940ab3bd52.tar.gz ayatana-indicator-datetime-66fdcd86c7de338563e5da1477481a940ab3bd52.tar.bz2 ayatana-indicator-datetime-66fdcd86c7de338563e5da1477481a940ab3bd52.zip |
Merge branch 'tari01-pr/fix-g-time-zone-new'
Attributes GH PR #41: https://github.com/AyatanaIndicators/ayatana-indicator-datetime/pull/41
Diffstat (limited to 'src/locations.cpp')
-rw-r--r-- | src/locations.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/locations.cpp b/src/locations.cpp index 94ccb23..a2dc564 100644 --- a/src/locations.cpp +++ b/src/locations.cpp @@ -1,5 +1,6 @@ /* * Copyright 2013 Canonical Ltd. + * Copyright 2021 Robert Tari * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License version 3, as published @@ -15,6 +16,7 @@ * * Authors: * Charles Kerr <charles.kerr@canonical.com> + * Robert Tari <robert@tari.in> */ #include <datetime/locations.h> @@ -47,7 +49,16 @@ Location::Location(const std::string& zone_, const std::string& name_): m_zone(zone_), m_name(name_) { + #if GLIB_CHECK_VERSION(2, 68, 0) + auto gzone = g_time_zone_new_identifier(zone().c_str()); + + if (gzone == NULL) + { + gzone = g_time_zone_new_utc(); + } + #else auto gzone = g_time_zone_new (zone().c_str()); + #endif auto gtime = g_date_time_new_now (gzone); m_offset = g_date_time_get_utc_offset (gtime); g_date_time_unref (gtime); |