I thought it would be interesting to know that IANA timezones are currently using the abbreviation "GMT", both now and after 6 months (to catch them currently in the summertime).
Using this free open source C ++ 11/14 library, I wrote this program:
#include "tz.h" #include <string> #include <iostream> #include <vector> template <class Duration> std::vector<date::zoned_time<std::common_type_t<Duration, std::chrono::seconds>>> find_by_abbrev(date::sys_time<Duration> tp, const std::string& abbrev) { using namespace std::chrono; using namespace date; std::vector<zoned_time<std::common_type_t<Duration, seconds>>> results; auto& db = get_tzdb(); for (auto& z : db.zones) { if (z.get_info(tp).abbrev == abbrev) results.push_back(make_zoned(&z, tp)); } return results; } int main() { using namespace std::chrono; using namespace date; auto now = system_clock::now(); auto v = find_by_abbrev(now, "GMT"); for (auto const& x : v) std::cout << format("%F %H:%M:%S %Z %z", x) << " " << x.get_time_zone()->name() << '\n'; std::cout << '\n'; v = find_by_abbrev(now + months{6}, "GMT"); for (auto const& x : v) std::cout << format("%F %H:%M:%S %Z %z", x) << " " << x.get_time_zone()->name() << '\n'; }
It searches for a planet for all time zones that currently use GMT, both now and after 6 months, and prints them:
2016-06-18 01:00:25.632773 GMT +0000 Africa/Abidjan 2016-06-18 01:00:25.632773 GMT +0000 Africa/Accra 2016-06-18 01:00:25.632773 GMT +0000 Africa/Bissau 2016-06-18 01:00:25.632773 GMT +0000 Africa/Monrovia 2016-06-18 01:00:25.632773 GMT +0000 America/Danmarkshavn 2016-06-18 01:00:25.632773 GMT +0000 Atlantic/Reykjavik 2016-06-18 01:00:25.632773 GMT +0000 Etc/GMT 2016-12-17 15:55:01.632773 GMT +0000 Africa/Abidjan 2016-12-17 15:55:01.632773 GMT +0000 Africa/Accra 2016-12-17 15:55:01.632773 GMT +0000 Africa/Bissau 2016-12-17 15:55:01.632773 GMT +0000 Africa/Monrovia 2016-12-17 15:55:01.632773 GMT +0000 America/Danmarkshavn 2016-12-17 15:55:01.632773 GMT +0000 Atlantic/Reykjavik 2016-12-17 15:55:01.632773 GMT +0000 Etc/GMT 2016-12-17 15:55:01.632773 GMT +0000 Europe/Dublin 2016-12-17 15:55:01.632773 GMT +0000 Europe/London
I was pleased to see that in all cases, the UTC offset was +0000 . You never know with politicians and time zones. Some legislators could easily proclaim Green Mountain Time (and maybe only tomorrow).
source share