jaroslawhartman / TimeZones-Alfred

Alfred Workflow
https://jhartman.pl/tag/time-zones/
Apache License 2.0
496 stars 20 forks source link

Add support for utc #22

Closed mazinbokhari closed 4 years ago

geoffreywiseman commented 5 years ago

This is the primary thing I wanted tz for, and sadly, not currently supported. 😭

jaroslawhartman commented 5 years ago

Hi @mazinbokhari, hi @geoffreywiseman

Could you please describe the usecase? I.e. how the search text should look like?

Thank you, Jarek

geoffreywiseman commented 5 years ago

So, I often deal with servers that are configured for UTC (configuring servers with UTC as the system time zone is a fairly common practice), but not SO often that UTC conversion is natural to me yet.

So when I'm looking at a log file, I might see a log entry from 14:36 UTC and I'll wonder "What time is that?" and then I'd like to be able to call up Alfred and say "tz utc 14:36" and see what 14:36 UTC is here in my time zone, or possibly in the timezone of another user.

Or I'll want to find something based on my knowledge of when the event occurred, so I might want to find a database record created within a certain time window, which requires me to take times from my time zone (or the timezone of a user) and find out what the UTC equivalent would be. In this case, maybe "tz 09:30" to find out what the UTC equivalent of 9:30 local would be.

joshka commented 4 years ago

+1 on this, all my server logs are in UTC, but some sites are in my local TZ and I regularly deal with other countries. Making this work out of the box would would make this amazing.

An easy way to implement this (will do when I have some time) would be to just add the Etc/UTC timezones as special locations in the cities csv file (.e.g UTC = Etc/UTC, UTC+1 = Etc/GMT-1 etc.)

A quick workaround that works in the current version is to add a line in the timezone list file like:

UTC|United Kingdom|Etc/UTC|UTC||0|0
UTC+1|United Kingdom|Etc/GMT-1|UTC+1||0|0

See https://en.wikipedia.org/wiki/List_of_tz_database_time_zones for Timezones that will work in there - note that the value for Etc/GMT-X is reversed. See https://en.wikipedia.org/wiki/Tz_database#Area for reasons

mohoromitch commented 4 years ago

I think the best workaround right now would be to use a city like Reykjavik, which uses GMT (UTC+0) year round. This does bring into question daylight savings time support (which is covered in #34) however, but that's beyond the scope of this issue.

jaroslawhartman commented 4 years ago

Added to v2.16:

Screenshot 2020-08-16 at 20 06 27 Screenshot 2020-08-16 at 20 33 47

Will be released soon.