KF5: Parsing times with timezone abbreviations

Kevin Kofler kevin.kofler at chello.at
Mon Mar 31 11:53:37 BST 2014


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)?

        Kevin Kofler





More information about the kde-core-devel mailing list