Adding UTC to timezones

David Jarvie djarvie at kde.org
Sat Sep 6 19:46:34 BST 2008


On Sat 6 September 2008 18:12:48 Aaron J. Seigo wrote:
> On Saturday 06 September 2008, David Jarvie wrote:
> > KSystemTimeZones encapsulates all the time zones defined in the system
> > time zone database. If UTC isn't in the database, it will not appear in
> > KSystemTimeZones. Because UTC is the basic time zone to which all other
> > time zones refer in their definitions, it isn't necessary for the system
> > time zone database to include it - it always exists regardless, which is
> > why KTimeZone::utc() is able to create a version of it.
> >
> > If it is convenient in an application to add it to the time zone
> > collection returned by KSystemTimeZones::zones(), then by all means do
> > so, although your code isn't correct (the return type is 'const
> > KTimeZones::ZoneMap').
>
> ...
>
> > To remove a UTC time zone from a collection, it is always safest to find
> > it by name "UTC" - there is no guarantee that different collections
> > contain the same UTC instance. See the KTimeZone::utc() apidox.
>
> great, so now that we've talked about all the interesting details that one
> can trip up over while simply trying to show UTC to the user in a config
> dialog ...
>
> ... does it now make sense to you that KTimeZoneWidget provides an option
> to show UTC so that we can encapsulate all these details and make it fool
> proof?
>
> e.g. KTimeZoneWidget::showUTC(bool show).

I'm not clear how UTC would fit into KTimeZoneWidget, since it doesn't have a 
location - presumably it would be placed at the start of the list. Assuming 
that issue is addressed, I would suggest including UTC in KTimeZoneWidget by 
default, since it is always a valid time zone. Perhaps there should be an 
option to exclude UTC, if there may be use cases where UTC would not be 
wanted.

-- 
David Jarvie.
KAlarm author and maintainer.
http://www.astrojar.org.uk/kalarm




More information about the kde-core-devel mailing list