Hello to all, and especially to Georg Zotti. :) For my work on the time zone feature I'll have to do some work on the delta-T feature. I need to understand it first, so I have several questions about its current implementation. This e-mail is better read with Stellarium's code open in Qt Creator, because Qt Creator allows for fast lookup and jumping between methods.
**None of this should be interpreted as an urgent need to change the code - I'm asking for changes I'm going to make in my branch.** >From what I've read so far: Delta-T is handled in StelCore. The same class keeps the current observer time as a Julian Date. In the old version, that JD was in UTC. In the new version, StelCore::JDay is in Terrestrial Time. Is this correct? In the current implementation, the delta-T correction needs to be applied to a JD before calling StelCore::setJDay(). There are cases in which it is not applied, for example: - In StelCore::init(), StelCore::setJDay() is used in the "preset sky time" initialization case with no delta-T correction. - In StelCore::setTodayTime(), which in turn is called by StelCore::init() to provide the "time of day" initialization case. I assume those cases have been overlooked or ignored. (There are also a few cases that have been deliberately and correctly ignored - for example, in StelCore::addSolarDays().) Do I understand correctly that the delta-T correction is usually applied only once, on setting the JD, and then the correction is no longer updated? (Even though StelCore::JDay is updated in StelCore::update() and it can be modified rather drastically without using setJDay(), for example by StelCore::addSiderealYear().) Do I understand correctly that while the internal time is in Terrestrial Time, the date/times displayed to and set by the users are not? (For example, ConfigurationDialog::setFixedDateTimeToCurrent() removes delta-T before displaying the date/time; this happens again in DateTimeDialog::setDateTime(), and a straight correction is applied in DateTimeDialog:: ) Some of the delta-T corrections/reverse corrections are dependent on whether the observer is on the Earth. Is this really necessary? (I think it's not - time in Stellarium is always Earth time.) It's also inconsistent, so it's possible to set a non-corrected JD value on one planet, jump to another and then various functions will apply an anti-correction. StelObject::getSideralPosGeometric() and getSideralPosApparent() use getDeltaT() for something that looks like reverse correction - the following expression is passed as a parameter: -core->getLocalSideralTime()+dt , which is equivalent to -(core->getLocalSiderealTime() - dt). Does this mean that this reverse correction can be removed, if the underlying function (StelCore::getLocalSiderealTime()) uses JD(UTC) instead of terrestrial time? I'm a bit confused by StelCore::getIsTimeNow(). It uses getJDay(), getting the system time and applying a delta-T correction. I think there might be a mistake there, and I'm not sure about the logic of the whole thing. Any pointers? Do I understand correctly that, because of the typical small values of deltaT, converting from terrestrial time back to UTC means computing the deltaT for the JD(TT) as if it was a JD(UTC), and then substracting it? Because this is how it's done for every reverse correction at the moment. WHAT I'M GOING TO DO in my branch: The solution I'm thinking of is keeping two separate JD values in StelCore - one for JD(UTC) and one for JD(TT), derived from the other one. Delta-T correction will be applied in StelCore::setJDay(). (The other alternative is to apply it at getJDay(), but it will be computationally expensive and may cause problems.) There will be a way to set a JD(TT) directly, and a way to specify whether one wants to get a JD(TT) or JD(UTC). This will remove the need of reverse corrections. At the moment, I'm trying to decide how exactly this should be implemented best (separate functions or a flag or bool parameter, etc.). Any questions, ideas or criticism? REFERENCES: List of all encounters of getDeltaT(): - Satellite::update() uses StelCore::getJDay() and then StelCore::getDeltaT() to make a reverse correction. - In the TelescopeControl plug-in, there is a strange reverse correction in getNow() (TelescopeClient.cpp) and GetNow() (Socket.cpp). - StelCore::setTimeNow() gets a JD from the current system time and uses StelCore::setJDay() and getDeltaT() to set a "corrected" JD value. One of the time initialization entry points. - StelCore::getIsTimeNow() - see above. - StelObject::getSideralPosGeometric() and getSideralPosApparent() - see above. - StelObserver::getRotAltAzToEquatorial() again has something that appears to be a reverse correction to the value returned by Planet::getSiderealTime(jd). It also has an "Earth condition". - ConfigurationDialog::setFixedDateTimeToCurrent() has a reverse correction to display a date/time. - DateTimeDialog::createDialogContent() has a correction in a call to setDateTime(), and, ironically, there is one in setDateTime() itself, so it's applied twice. :) - DateTimeDialog::newJd() has a straight correction and an "Earth condition". - BottomStelBar::updateText() calls getDeltaT() to display its value. :) - StelMainScriptAPI::setDate() has an option to apply a correction to a date entered by the user. - StelMainScriptAPI::getDeltaT() is a wrapper/convertor of StelCore::getDeltaT(). Calls to StelCore::setJDay(): In StelCore::init(), it's used in the "preset sky time" initialization case - without any delta-T correction. :) In StelCore::setTimeNow() - see above. In StelCore::setTodayTime(), which in turn is called by StelCore::init() to provide the "time of day" initialization case. Again, no delta-T correction. In StelCore::addSolarDays() and addSiderealDays() it's used together with getJDay(), and the lack of correction is probably deliberate, as the value returned by JDay is already in TT. WARNING - if a conversion is added in setJDay, this will have to be reworked. In StelMovementMgr::dragView() it's used together with getJDay in a similar manner. In DateTimeDialog::valid(), it's used to set Stellarium to the date/time entered by the user. It uses the delta-T correction done in DateTimeDialog::newJd(). StelMainScriptAPI::setJDay() is straight wrapper of StelCore::setJDay(). StelMainScriptAPI::setDate() converts a date/time string to a JD and sets it. It has an option to apply or assume applied delta-T correction. Regards, Bogdan Marinov ------------------------------------------------------------------------------ Get 100% visibility into Java/.NET code with AppDynamics Lite! It's a free troubleshooting tool designed for production. Get down to code-level detail for bottlenecks, with <2% overhead. Download for free and get started troubleshooting in minutes. http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk _______________________________________________ Stellarium-pubdevel mailing list Stellarium-pubdevel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/stellarium-pubdevel