Bug 256789

Summary: Bad calculated album mean date when pictures before 1970
Product: [Applications] digikam Reporter: Stéphane Pontier <shadow.walker>
Component: Metadata-DateAssignee: Digikam Developers <digikam-bugs-null>
Severity: minor CC: caulier.gilles, KaiUweBroulik2
Priority: NOR    
Version: 1.5.0   
Target Milestone: ---   
Platform: Mandriva RPMs   
OS: Linux   
Latest Commit: Version Fixed In: 2.0.0
Attachments: Picture tagged from 1910-05-28

Description Stéphane Pontier 2010-11-13 13:06:57 UTC
Version:           1.5.0 (using Devel) 
OS:                Linux

When I open an album property and try to set the album date to a mean date of all picture inside and picture are before 1970 I always obtain the date: 07/02/2106
If I try to set the album date by clicking on the most recent or the older, the date is setted right
If I try to set the date by clicking on the mean date and picture inside is from 1970 and above, the date is set roght

Reproducible: Always

Steps to Reproduce:
1 create an album
2 put a picture with date before 1970 (ie 01/01/1969)
3 open the album property
4 set the date by clicking on the mean date
5 look at the 07/02/2106 date obtained

Actual Results:  
07/02/2106 is obtained

Expected Results:  
01/01/1969 should be obtained
Comment 1 Marcel Wiesweg 2010-11-13 14:14:43 UTC
Interesting problem. Obviously, the Unix Epoch does have its weaknesses ;-)
Can you provide such a picture for testing? I would like to see where it works and where things break.
Comment 2 Kai Uwe Broulik 2010-11-14 01:49:18 UTC
Seems to be an variable overflow/negative sign fault
Comment 3 Stéphane Pontier 2010-11-15 11:49:12 UTC
Created attachment 53430 [details]
Picture tagged from 1910-05-28
Comment 4 Marcel Wiesweg 2011-01-28 11:34:44 UTC
SVN commit 1217733 by mwiesweg:

Do not use time_t when calculating average date, that works only on a limited scale.
Use QDate's Julian Day to get a much wider range.

BUG: 256789

 M  +2 -1      NEWS  
 M  +10 -21    libs/database/albumdb.cpp  

WebSVN link: http://websvn.kde.org/?view=rev&revision=1217733