Timezone classes

David Jarvie lists at astrojar.org.uk
Tue Sep 20 15:12:53 BST 2005


On Sat Sep 17 20:00 , Shaheed <srhaque at iee.org> sent:
>On Thursday 15 September 2005 18:50, David Jarvie wrote:
>> KTimezones::local() doesn't allow for the possibility of /etc/localtime
>> being a link to a file in /use/share/zoneinfo/ (or wherever). This is quite
>> a common configuration, e.g. in Debian. The method also reads the files in
>> /use/share/zoneinfo/ *every* time it is called, which seems an unnecessary
>> overhead. Could the files' checksums be cached, and the files only be
>> reread if no match is found (which might indicate that the timezone
>> database had changed)?
>
>I commented on the link thing elsewhere. As for caching, it is deliberate, 
>otherwise the user could change the timezone and you would not see it. If you 
>want it cached, you can always do so!

What I was envisaging was that KTimezones::local() would always recalculate the /etc/localtime 
checksum and then try to match that to one of the cached /usr/share/zoneinfo checksums. It would 
then recalculate the checksum for the matching file and determine whether the checksums still match.

If the timezone database has changed, both /etc/localtime and the new database checksum should 
still match, since /etc/localtime would presumably have been updated in line with the file which it 
corresponds to. In that case, once the match has been confirmed, the cached checksum would be 
updated and no more action would be required.

If the user has changed the timezone but the timezone database remains the same, the new checksum 
for /etc/localtime would match any cached checksum for the file now referred to.

If both the user timezone and the timezone database have changed, the new /etc/localtime checksum 
would not now match any cached value, and the cache would have to be refreshed.

>I won't have a chance to look at this for a while, if you want to have a hack 
>in the meantime, be my guest. There is a small testsuite in the tests 
>directory.

I'll try to produce some code, time permitting.

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





More information about the kde-core-devel mailing list