QDate range extended

David Jarvie lists at astrojar.org.uk
Wed Jun 14 09:58:31 BST 2006


On Wednesday 14 June 2006 8:12, Thiago Macieira wrote:
>Jason Harris wrote:
>>Since David brought it up...if the -4712 limit is essentially arbitrary,
>> I'd like to request that it be removed.  I guess I've made my case
>> before for wanting very remote dates in KStars.  I understand that most
>> other apps won't need a larger range of years, but if there's nothing
>> stopping you from providing a much larger range of years, then why not
>> do it?
>
>-4712 is not arbitrary. And I thought you would be the first to realise 
>what year that is: QDate allows you to go as far back as julian day 0.
>
>You cannot go even more backwards because QDate has an *unsigned* int as 
>its only member. So the earliest it can see is julian day 0.

Surely the solution to Jason's needs is to make the Julian day a signed value. This would 
allow QDate to represent dates more than 350,000 years before and after the current time. I 
imagine that this would be sufficient for KStars (although for dinosaurs and red giants, you 
might need to use a qint64...). I suspect that making it signed would make little difference 
to the QDate code, except for the need to replace zero with 0x8000000 or 0x7FFFFFFF as the 
indicator of an invalid date.

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




More information about the kde-core-devel mailing list