Call now: (800) 766-1884  



 Home


 SQL Server Tips
 SQL Server Training

 SQL Server Consulting
 SQL Server Support
 SQL Server Remote DBA



 Articles
 Services
 SQL Server Scripts
 Scripts Menu



 

 

 

 
 

SQL Server

SQL Server Tips by Gama and Naughter Consulting

 


XP_ASTRO_DELTAT

The next XP in XP_ASTRO is called XP_ASTRO_DELTAT and again is related to the general area of date time calculations. The time that is used in normal civil life is called Universal Time (UT) or Greenwich Civil Time. Because UT is based on the Earth’s rotation, which is gradually slowing down, UT is not a uniform time. To produce accurate astronomical calculations a uniform time scale is required. The time scale used in astronomical calculations since the 1960’s was called Ephemeris Time (ET) and was based on planetary motions. This is the value that you would see published in the astronomical almanacs of the day. In the early 1980’s ET was replaced by Dynamical Time (TD) and is defined by atomic clocks. Dynamical Time can be thought of as a simple continuation of Ephemeris Time. The difference between Dynamical Time and Universal time is called DeltaT (?T) and can only be determined from observation. Normally what happens is that “leap seconds” are introduced into UT every so often. This helps to keep UT in sync with the Earth’s rotation. Only approximate values for DeltaT can be provided for times in the distant past and into the future. This means that events far in the future or past, which are dependent on the position of the observer on the face of the Earth such as Solar Eclipses, cannot be accurately determined when the result needs to be expressed in civil time (which in the case of a Solar Eclipse determines where on the Earth the Solar Eclipse will be visible from).

The AA+ function “CAADynamicalTime::DeltaT” is used to perform the key calculation for this XP. This function takes a Julian Day, which we should have, already calculated using the XP_ASTRO_DATE2JULIAN XP. The return value from XP_ASTRO_DELTAT can be expressed mathematically as:

?T = TD - UT

Internally the code in “CAADynamicalTime::DeltaT” uses a lookup array for the dates between the years 1620 to 1998. Outside of this range various polynomial expressions are used as an approximation.

The normal route taken for astronomical calculations such as to calculate the position of a planet at a given time is to first convert the calendar date expressed in Universal Time to a Julian Day via the XP_ASTRO_DATE2JULIAN XP. Then this value is modified by adding the value returned from XP_ASTRO_DELTAT to it (divided by 86,400 of course to convert to a fraction of a day). The resultant value will be the Julian Day for the given date in Dynamical Time. This value is commonly called Julian Ephemeris Day (JED). This value can then be passed to various functions in the AA+ class framework. For further information on using the AA+ framework please consult the HTML documentation included in the complete AA+ download.


The above book excerpt is from:

Super SQL Server Systems
Turbocharge Database Performance with C++ External Procedures

ISBN: 0-9761573-2-2
Joseph Gama, P. J. Naughter

 http://www.rampant-books.com/book_2005_2_sql_server_external_procedures.htm

 


 

 

 

Burleson Consulting Remote DB Administration


 

 


 

 

 

 

 
Burleson is the America's Team

Note: The pages on this site were created as a support and training reference for use by our staff of DBA consultants.  If you find it confusing, please exit this page.

Errata?  SQL Server technology is changing and we strive to update our SQL Server support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:and include the URL for the page.
 


Burleson Consulting
SQL Server database support

 

Copyright © 1996 -  2013 by Vaaltech Web Services. All rights reserved.

Hit Counter