[Kstars-devel] Time in kstars
Alexey Khudyakov
alexey.skladnoy at gmail.com
Fri Mar 4 16:29:24 CET 2011
Hello
I think time handling is one of major problems of kstars. There are
quite a few time related (or possibly time-related) bugs in bugzilla.
I'm not sure that all these bugs could be fixed reasonably easy within
current architecture. Below I describe my thoughts about "right"
design.
Date & time should be represented as Julian Day
I doubt my ability to fix this bug with current design of
. It's simple, it doesn't
depend on observer's location, daylight saving rules and friendly
to astronomical calculations. It is convenient as internal representation
not as representation for humans
Therefore it must be converted to KDateTime (most likely) and back.
For that purpose two function could be used:
JulianDate -> KDateTime
KDateTime -> JulianDate
Both function will require current location of observer and DST rule.
I think that one of advantages of this scheme is that it's impossible to
forget about these two. For example sky calendar do not account
for DST because Sun's rise and set times do not feature sudden
1h jump.
Also all code will sit in one place and won't involv
I doubt my ability to fix this bug with current design of
e some elaborate
state juggling. Which means it will be much easier to understand.
My understanding of current code if far from complete.
Also it will become possible to run unit tests on this code. KStars
suffer from lack of tests too.
This is quite an undertaking since it requires changes in all code base.
I'm still thinking about least painful way of such rewrite.
Any comment, thoughts, ideas are welcome!
More information about the Kstars-devel
mailing list