[Kde-pim] Review Request: [Fancy date format] "Today" not updated after midnight

Olivier Trichet nive at nivalis.org
Mon Jun 1 14:42:27 BST 2009


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://reviewboard.kde.org/r/661/
-----------------------------------------------------------

(Updated 2009-06-01 06:42:26.996163)


Review request for KDE PIM.


Changes
-------

Sorry for the late reply, I wrote the benchmark but never uploaded the result.

The changes :
- Readd the test on "mTodayOneSecondBeforeMidnight<0".

- The benchmark (ran in release mode without cpu frequency scaling) shows up an increase of 1 to 4 % of the time (a few 10ns increase) in this peticular method after this change.
Each run calls the method 40 times with differents date/time to simulate the actual use case (date display in the message list).

$ ./kmime_dateformatter_fancy_bench.shell -iterations 1000
********* Start testing of FancyFormatterBench *********
Config: Using QTest library 4.5.1, Qt 4.5.1
PASS   : FancyFormatterBench::initTestCase()
RESULT : FancyFormatterBench::test():"fancyLegacy 2004 -> 2009":
     1.330 msec per iteration (total: 1331, iterations: 1000)
RESULT : FancyFormatterBench::test():"fancyTimecall 2004 -> 2009":
     1.344 msec per iteration (total: 1345, iterations: 1000)
RESULT : FancyFormatterBench::test():"fancyLegacy last 2 days":
     0.937 msec per iteration (total: 938, iterations: 1000)
RESULT : FancyFormatterBench::test():"fancyTimecall last 2 days":
     0.946 msec per iteration (total: 947, iterations: 1000)
RESULT : FancyFormatterBench::test():"timeCall":
     0.006 msec per iteration (total: 6, iterations: 1000)
PASS   : FancyFormatterBench::test()
PASS   : FancyFormatterBench::cleanupTestCase()
Totals: 3 passed, 0 failed, 0 skipped
********* Finished testing of FancyFormatterBench *********


With 400 method call per run:
$ ./kmime_dateformatter_fancy_bench.shell -iterations 1000                                                                                                                                   
********* Start testing of FancyFormatterBench *********                                                                                                                                                                                     
Config: Using QTest library 4.5.1, Qt 4.5.1
PASS   : FancyFormatterBench::initTestCase()
RESULT : FancyFormatterBench::test():"fancyLegacy 2004 -> 2009":
     1.318 msec per iteration (total: 1318, iterations: 1000)
RESULT : FancyFormatterBench::test():"fancyTimecall 2004 -> 2009":
     1.330 msec per iteration (total: 1330, iterations: 1000)
RESULT : FancyFormatterBench::test():"fancyLegacy last 2 days":
     0.924 msec per iteration (total: 924, iterations: 1000)
RESULT : FancyFormatterBench::test():"fancyTimecall last 2 days":
     0.938 msec per iteration (total: 939, iterations: 1000)
RESULT : FancyFormatterBench::test():"timeCall":
     0.007 msec per iteration (total: 7, iterations: 1000)
PASS   : FancyFormatterBench::test()
PASS   : FancyFormatterBench::cleanupTestCase()
Totals: 3 passed, 0 failed, 0 skipped
********* Finished testing of FancyFormatterBench *********


Summary
-------

This change checks if the precalculed date/time of the end of the current day is still valid, otherwise it is updated.

The root of the issue is that KNode's headerview and KMail's MessageListView allocate only one instance of DateFormatter so that "mTodayOneSecondBeforeMidnight" is never updated.
The article view used static method from DateFormatter and the correct "mTodayOneSecondBeforeMidnight" is used.

Is it ok to call time() each time fancy() is called ?


This addresses bug 178035.
    https://bugs.kde.org/show_bug.cgi?id=178035


Diffs (updated)
-----

  /dev/null 976114 
  trunk/KDE/kdepimlibs/kmime/kmime_dateformatter.cpp 976114 
  trunk/KDE/kdepimlibs/kmime/tests/CMakeLists.txt 976114 

Diff: http://reviewboard.kde.org/r/661/diff


Testing
-------

I reproduced the bug last night in KNode and validate the fix tonight.


Thanks,

Olivier

_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/



More information about the kde-pim mailing list