[Kstars-devel] kdeedu/kstars/kstars [POSSIBLY UNSAFE]

Jason Harris kstars at 30doradus.org
Mon May 17 05:10:58 CEST 2004


CVS commit by harris: 

Adding class KStarsDateTime (KSDT), which is derived from 
ExtDateTime, and adds some astronomy-specific functionality.  
One important change is that KSDT stores the Julian Day 
internally as a long double (so it includes the time as well).  The 
accessor for this is "djd()", because "jd()" already exists in 
ExtDateTime (it returns the JD as an integer).  AFAIK, it is not 
possible to overload a function such that it returns a different 
data type.  If it is possible, please let me know.

Other important functions in KSDT:

+ ctors which take: int, double, long double (each specify JD)
                    KSDT (copy ctor)
                    ExtDate and QTime

+ setDJD(long double): sets the JD, sets the calendar date  
                       and time as well.

+ setDate( ExtDate ):  Reset the date (keeps current time)
+ setTime( QTime ):  Reset the time (keeps current date)

+ comparison operators ( ==, !=, >, >=, <, <= )

+ currentDateTime() [static]: returns KSDT from CPU clock 

+ jdFrac(): returns non-integer portion of djd()
+ JDat0hUT: returns JD for the current date at midnight 
              (so ends in .5)

+ gst(): returns dms for the current Greenwich Sidereal Time
+ GSTtoUT( dms gst ): returns QTime for the UT corresponding  
                      to gst on the date of the parent KSDT object.

+ epoch(): returns the epoch of the KSDT object 
          (i.e., J2000 = 2000.0)
+ setFromEpoch( double e ):  Set the date/time from the epoch


In addition, I added some conversion functions to GeoLocation:

+ GSTtoLST( dms gst ): return the local sidereal time 
                       (dms object) for the location, given gst
+ LSTtoGST( dms lst ): vice versa
+ UTtoLT( KSDT ut ):   return the local time (KSDT) for the 
                       location, given the UT
+ LTtoUT( KSDT lt ):   vice versa.

So, for example, to compute LST we used to do:
    dms LST = KSUtils::UTtoLST( ut.time(), geo->lng() );

and we now do:
    dms LST = geo->GSTtoLST( ut.gst() );

In fact, all time-related functions in KSUtils have been replaced 
by the new functions in KSDT or GeoLocation.  KSUtils has only 
2 functions in it now.

I also tweaked the timesteps in TimeSpinBox; the large timesteps 
are now multiples of a sidereal year.  This makes the animations 
smoother.


unrelated fixes:  

KSUtils::lagrangeInterpolation now uses long doubles instead of 
doubles, so we should now have sub-second precision in determining 
the exact moments of equinoxes and solstices.

Fixed memory leaks in modcalcplanets

CCMAIL: kstars-devel at kde.org


  A            kstarsdatetime.cpp   1.1 [GPL (v2+)]
  A            kstarsdatetime.h   1.1 [GPL (v2+)]
  M +1 -1      Makefile.am   1.115
  M +87 -91    detaildialog.cpp   1.35
  M +9 -15     detaildialog.h   1.12
  M +2 -2      devicemanager.cpp   1.12
  M +0 -1      dms.cpp   1.29
  M +23 -24    dms.h   1.16
  M +1 -1      focusdialog.cpp   1.20
  M +0 -2      geolocation.cpp   1.11
  M +7 -0      geolocation.h   1.15
  M +5 -5      indistd.cpp   1.13
  M +3 -2      infoboxes.cpp   1.19
  M +2 -3      infoboxes.h   1.12
  M +2 -2      kscomet.cpp   1.11
  M +18 -12    kspopupmenu.cpp   1.23
  M +8 -11     kssun.cpp   1.19
  M +3 -2      kstars.cpp   1.83
  M +12 -15    kstarsactions.cpp   1.100
  M +36 -45    kstarsdata.cpp   1.130
  M +19 -20    kstarsdata.h   1.82
  M +4 -5      kstarsdcop.cpp   1.25
  M +1 -1      kstarsinit.cpp   1.89
  M +3 -203    ksutils.cpp   1.22
  M +6 -103    ksutils.h   1.13
  M +5 -3      main.cpp   1.36
  M +40 -56    simclock.cpp   1.18
  M +7 -15     simclock.h   1.13
  M +2 -2      simclockinterface.h   1.6
  M +5 -5      skymap.cpp   1.130
  M +2 -2      skymapdraw.cpp   1.63
  M +46 -82    skyobject.cpp   1.39
  M +19 -25    skyobject.h   1.37
  M +10 -14    telescopewizardprocess.cpp   1.16 [POSSIBLY UNSAFE: printf]
  M +43 -57    timedialog.cpp   1.16
  M +4 -4      timedialog.h   1.12
  M +46 -42    timespinbox.cpp   1.11
  M +34 -31    timezonerule.cpp   1.16
  M +23 -23    timezonerule.h   1.9
  M +37 -66    tools/altvstime.cpp   1.17
  M +4 -23     tools/altvstime.h   1.10
  M +2 -2      tools/jmoontool.cpp   1.9
  M +1 -4      tools/lcgenerator.cpp   1.16
  M +20 -42    tools/modcalcapcoord.cpp   1.20
  M +3 -9      tools/modcalcapcoord.h   1.16
  M +28 -53    tools/modcalcazel.cpp   1.14
  M +6 -10     tools/modcalcazel.h   1.10
  M +14 -40    tools/modcalcdaylength.cpp   1.26
  M +4 -17     tools/modcalcdaylength.h   1.14
  M +26 -25    tools/modcalcequinox.cpp   1.4
  M +1 -1      tools/modcalcequinox.h   1.3
  M +470 -457  tools/modcalcequinoxdlg.ui   1.3
  M +8 -3      tools/modcalcgalcoord.cpp   1.22
  M +15 -20    tools/modcalcjd.cpp   1.22
  M +2 -3      tools/modcalcjd.h   1.13
  M +106 -123  tools/modcalcplanets.cpp   1.3
  M +10 -11    tools/modcalcplanets.h   1.2
  M +20 -36    tools/modcalcprec.cpp   1.24
  M +0 -3      tools/modcalcprec.h   1.9
  M +20 -32    tools/modcalcsidtime.cpp   1.34
  M +2 -1      tools/scriptbuilder.cpp   1.32
  M +11 -13    tools/wutdialog.cpp   1.29
  M +2 -2      tools/wutdialog.h   1.7





More information about the Kstars-devel mailing list