KSyCoca, Thread safety, and Cache invalidation
Thiago Macieira
thiago at kde.org
Wed Jul 15 00:01:09 BST 2015
On Tuesday 14 July 2015 19:28:58 Thomas Lübking wrote:
> Actually, checking currentTime() is already the problem here (causing the IO
> for the timezone stuff), see
> http://marc.info/?l=kde-core-devel&m=143533622526705&w=1 (the 1st paragraph
> part of my comment somehow turned into a second-level quote)
>
> Comparing a monotic timer (QElapsedTime) is however - at least on linux -
> close to cost free PLUS: one can have an entirely free "do not check again
> during this event cycle" flag.
If you just need to measure duration, QElapsedTime is your tool. Do not use
QTime for this, as it can be affected by clock jumps and it accesses the
timezone.
If you need a machine-comparable time with other systems or across reboots,
use QDateTime::currentDateTimeUtc(). That avoids refreshing the timezone
database to convert to local time.
Only use QDateTime::currentDateTime() if you want to show something to the
user. There's no other valid reason. (writing to a log counts as "showing to
the user")
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
Software Architect - Intel Open Source Technology Center
PGP/GPG: 0x6EF45358; fingerprint:
E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
More information about the kde-core-devel
mailing list