KF5: Parsing times with timezone abbreviations

David Jarvie djarvie at kde.org
Mon Mar 31 14:10:25 BST 2014


On Mon, March 31, 2014 11:53 am, Kevin Kofler wrote:
> Thiago Macieira wrote:
>> Time zone abbreviations are useless, since they are not unique. Simply
>> strip them out of your string before passing to QDateTime.
>
> Nice theory, but there is no other way to know what time this actually is.
> Unless you can offer a mapping from latitude and longitude to timezone, or
> a way to automatically figure it out from "place name, country" (which is
> especially fun for those countries that span multiple time zones, because
> the place name can be a small town somewhere).
>
> I do see the problem, e.g. I get "EST" as the timezone for Sydney,
> Australia, which is obviously not the same as the US "EST". I suppose
> KDateTime will do the wrong thing for that. :-(
>
> Maybe we need a (timezone abbreviation, country) → timezone map (and
an API
> where I can just feed in the time including the abbreviation and the
country
> name and get a correct QDateTime; heck, for most countries, the
abbreviation
> could be ignored entirely, it only matters for huge countries such as the
> USA or Russia)?

They can't just be ignored for small countries, since they may contain a
daylight savings time indication.

-- 
David Jarvie.
KDE developer.
KAlarm author - http://www.astrojar.org.uk/kalarm





More information about the kde-core-devel mailing list