Time
GMT Greenwich Mean Time begins at midnight differs by 12 hours
UT Universal Time begins at noon
ET Ephemeris Time from 1960 to 1983 based on planetary motions
DT Dinamical Time defined by atomic clocks prolongation of Ephemeris Time
TAI Temps Atomique International defined by a world-wide array of interlinked caesium clocks
TDB Barycentric Dynamical Time differs by at most 0.0017 seconds
TDT Terrestrial Dynamical Time due relativistic effect
TD Dinamical Time differ TDB/TDT neglected, and last letter droped
TT Terrestrial Time TDT shorted name
Delta T TD - UT + 65 seconds in 2000 the exact value deduced only from observations
+ 69 seconds in 2005
+ 80 seconds in 2015 UT = TD - delta T
MJD 51544 01 January 2000
Polynomial Expressions for Delta T
Adapted from "Five Millennium Canon of Solar Eclipses" [Espenak and Meeus]
Font: http://eclipse.gsfc.nasa.gov/SEhelp/deltatpoly2004.html
Between years 1900 and 1920, calculate:
ΔT = -2.79 + 1.494119 * t - 0.0598939 * t^2 + 0.0061966 * t^3 - 0.000197 * t^4 where: t = y - 1900
Between years 1920 and 1941, calculate:
ΔT = 21.20 + 0.84493*t - 0.076100 * t^2 + 0.0020936 * t^3 where: t = y - 1920
Between years 1941 and 1961, calculate:
ΔT = 29.07 + 0.407*t - t^2/233 + t^3 / 2547 where: t = y - 1950
Between years 1961 and 1986, calculate:
ΔT = 45.45 + 1.067*t - t^2/260 - t^3 / 718 where: t = y - 1975
Between years 1986 and 2005, calculate:
ΔT = 63.86 + 0.3345 * t - 0.060374 * t^2 + 0.0017275 * t^3 + 0.000651814 * t^4 + 0.00002373599 * t^5 where: t = y - 2000
Between years 2005 and 2050, calculate:
ΔT = 62.92 + 0.32217 * t + 0.005589 * t^2 where: t = y - 2000
This expression is derived from estimated values of ΔT in the years 2010 and 2050. The value for 2010 (66.9 seconds) is
based on a linearly extrapolation from 2005 using 0.39 seconds/year (average from 1995 to 2005). The value for 2050
(93 seconds) is linearly extrapolated from 2010 using 0.66 seconds/year (average rate from 1901 to 2000).
Between years 2050 and 2150, calculate:
ΔT = -20 + 32 * ((y-1820)/100)^2 - 0.5628 * (2150 - y)
The last term is introduced to eliminate the discontinuity at 2050.
After 2150, calculate:
ΔT = -20 + 32 * u^2 where: u = (year-1820)/100
All values of ΔT based on Morrison and Stephenson [2004] assume a value for the Moon's secular acceleration of -26
arcsec/cy^2. However, the ELP-2000/82 lunar ephemeris employed in the Canon uses a slightly different value
of -25.858 arcsec/cy^2. Thus, a small correction "c" must be added to the values derived from the polynomial expressions
for ΔT before they can be used in the Canon
c = -0.000012932 * (y - 1955)^2
Since the values of ΔT for the interval 1955 to 2005 were derived independent of any lunar ephemeris, no correction is
needed for this period.
Extrapolations from the table weighted by the long period trend from tidal braking of the Moon offer reasonable estimates
of +67 seconds in 2010, +93 seconds in 2050, +203 seconds in 2100, and +442 seconds in the year 2200.
The uncertainty in ΔT over this period can be estimated from scatter in the measurements.
2100 1 1 01/01/2100 203,0000 68,1400
1900 01/01/1900 1 -2,7000 1973 01/01/1973 26665 43,3730 2101 01/01/2101 73416
1973 01/01/1973 26665 43,3730 2016 01/01/2016 42370 70,0000 1955.5
73 2 182 43 12 15705 1955 01/07/1955 20271
146 182,6369863 146,510989 516 30,43604651 365,2325581 30,436
43 516,0007885
Leap Second
//Cumulative leap second values from 1 Jan 1961 to 1 July 2012 as taken from http://maia.usno.navy.mil/ser7/tai-utc.dat
Font: https://github.com/bodusb/ofxSpacetrack/blob/master/src/aaplus/AADynamicalTime.cpp
const LeapSecondCoefficient g_LeapSecondCoefficients[] =
{
{ 2437300.5, 1.4228180, 37300, 0.001296 },
{ 2437512.5, 1.3728180, 37300, 0.001296 },
{ 2437665.5, 1.8458580, 37665, 0.0011232 },
{ 2438334.5, 1.9458580, 37665, 0.0011232 },
{ 2438395.5, 3.2401300, 38761, 0.001296 },
{ 2438486.5, 3.3401300, 38761, 0.001296 },
{ 2438639.5, 3.4401300, 38761, 0.001296 },
{ 2438761.5, 3.5401300, 38761, 0.001296 },
{ 2438820.5, 3.6401300, 38761, 0.001296 },
{ 2438942.5, 3.7401300, 38761, 0.001296 },
{ 2439004.5, 3.8401300, 38761, 0.001296 },
{ 2439126.5, 4.3131700, 39126, 0.002592 },
{ 2439887.5, 4.2131700, 39126, 0.002592 },
{ 2441317.5, 10.0, 41317, 0.0 },
{ 2441499.5, 11.0, 41317, 0.0 },
{ 2441683.5, 12.0, 41317, 0.0 },
{ 2442048.5, 13.0, 41317, 0.0 },
{ 2442413.5, 14.0, 41317, 0.0 },
{ 2442778.5, 15.0, 41317, 0.0 },
{ 2443144.5, 16.0, 41317, 0.0 },
{ 2443509.5, 17.0, 41317, 0.0 },
{ 2443874.5, 18.0, 41317, 0.0 },
{ 2444239.5, 19.0, 41317, 0.0 },
{ 2444786.5, 20.0, 41317, 0.0 },
{ 2445151.5, 21.0, 41317, 0.0 },
{ 2445516.5, 22.0, 41317, 0.0 },
{ 2446247.5, 23.0, 41317, 0.0 },
{ 2447161.5, 24.0, 41317, 0.0 },
{ 2447892.5, 25.0, 41317, 0.0 },
{ 2448257.5, 26.0, 41317, 0.0 },
{ 2448804.5, 27.0, 41317, 0.0 },
{ 2449169.5, 28.0, 41317, 0.0 },
{ 2449534.5, 29.0, 41317, 0.0 },
{ 2450083.5, 30.0, 41317, 0.0 },
{ 2450630.5, 31.0, 41317, 0.0 },
{ 2451179.5, 32.0, 41317, 0.0 },
{ 2453736.5, 33.0, 41317, 0.0 },
{ 2454832.5, 34.0, 41317, 0.0 },
{ 2456109.5, 35.0, 41317, 0.0 }
};
LeapSeconds function takes as input the
Excel date value or
Julian Day value
and returns the cumulative total of Leap seconds which have
been applied to this point. For more information about
leap seconds please see http://en.wikipedia.org/wiki/Leap_second.
Using this method you can now implement code which converts
from Terrestial Time to Coordinated Universal time as follows:
double TerrestialTime = some calculation using algorithms(JD); double DeltaT = DeltaT(JD);
The time of the event using the UT1 time scale:
double UniversalTime1 = TerrestialTime - DeltaT/86400.0;
The time of the event using the TAI time scale:
double TerrestialAtomicTime = TerrestialTime - (32.184/86400.0);
double LeapSeconds = LeapSeconds(JD);
The time of the event using the UTC time scale:
double CoordinatedUniversalTime = (DeltaT - LeapSeconds - 32.184)/86400.0 + UniversalTime1; ?
UTC = (TerrestialTime - (DeltaT/86400.0)) + (DeltaT(jdtt) - LeapSeconds(jdtt) - 32.184)/86400.0 ?
TT - Terrestrial Time
Ref: https://en.wikipedia.org/wiki/Terrestrial_Time
Terrestrial Time (TT) is a modern astronomical time standard defined by the International Astronomical Union, primarily for
time-measurements of astronomical observations made from the surface of Earth. For example, the Astronomical Almanac
uses TT for its tables of positions (ephemerides) of the Sun, Moon and planets as seen from Earth. In this role, TT continues
Terrestrial Dynamical Time (TDT), which in turn succeeded ephemeris time (ET).
TT shares the original purpose for which ET was designed, to be free of the irregularities in the rotation of Earth.
The unit of TT is the SI second, the definition of which is currently based on the caesium atomic clock, but TT is not itself
defined by atomic clocks. It is a theoretical ideal, which real clocks can only approximate.
TT is distinct from the time scale often used as a basis for civil purposes, Coordinated Universal Time (UTC). TT indirectly
underlies UTC, via International Atomic Time (TAI). Each leap second that is introduced into UTC causes UTC to diverge a little
further from TT.
Approximation
Sometimes times described in TT must be handled in situations where TT's detailed theoretical properties are not significant.
Where millisecond accuracy is enough (or more than enough), TT can be summarized in the following ways:
To millisecond accuracy, TT runs parallel to the atomic timescale (International Atomic Time, TAI) maintained by the BIPM. TT is ahead of TAI, and can be approximated as TT ≅ TAI + 32.184 seconds. (The offset 32.184 s arises from the history.) TT also runs in parallel with the GPS time scale, which has a constant difference from atomic time (TAI − GPS time = +19 seconds), so that TT ≅ GPS time + 51.184 seconds. TT is in effect a continuation of (but is more precisely uniform than) the former Ephemeris Time (ET). It was designed for continuity with ET, and it runs at the rate of the SI second, which was itself derived from a calibration using the second of ET (see, under Ephemeris time, Redefinition of the second and Implementations.) TT runs a little ahead of UT1 (a refined measure of mean solar time at Greenwich) by an amount known as ΔT = TT − UT1. ΔT was measured at +65.7768 seconds (TT ahead of UT1) at 0h UTC on 1 January 2009; and by retrospective calculation, ΔT was close to zero around the year 1900. The difference ΔT, though somewhat unpredictable in fine detail, is expected to continue to increase, with UT1 becoming steadily (but irregularly) further behind TT in the future.
The different time scales
TAI = International Atomic Time (Temps Atomique International = TAI) is
defined as the weighted average of the time kept by about 200
atomic clocks in over 50 national laboratories worldwide.
TAI-UT1 was approximately 0 on 1958 Jan 1.
UTC = Coordinated Universal Time. Differs from TAI by an integral
number of seconds. When needed, leap seconds are introduced in UTC
to keep the difference between UTC and UT less than 0.9 s.
UTC was introduced in 1972.
UT = Universal time. Defined by the Earth's rotation, formerly determined
by astronomical observations but today GPS satellites are used
instead. This time scale is slightly irregular. There are several
different definitions of UT, but the difference between them is always
less than about 0.03 s.
UT0 = "raw", uncorrected UT as derived from meridian circle observations
or from more modern methods involving GPS satellites.
UT1 = UT0 corrected for polar wandering - usually one means UT1 when
saying UT.
UT2 = UT1 corrected for seasonal variations in the Earth's rotational
speed, by adding
+ 0.022 * sin(2pit) - 0.017 * cos(2pit)
- 0.007 * sin(4pit) + 0.006 * cos(4pit)
seconds to UT1, where t is the fraction of the year (zero at 1 Jan).
UT2 is nowadays considered obsolete.
ET = Ephemeris Time. Was used 1960-1983, and was replaced by TDT and TDB
in 1984. For most purposes, ET up to 1983 Dec 31 and TDT from 1984
Jan 1 can be regarded as a continuous time-scale.
TDT = Terrestial Dynamical Time. Was used 1984-2000 as a time-scale of
ephemerides from the Earth's surface. TDT = TAI + 32.184. Replaced
ET (Ephemeris Time) in 1984, was replaced by TT (Terrestial Time)
in 2001.
TDB = Barycentric Dynamical Time. Used as a time-scale of ephemerides
referred to the barycentre of the solar system. Differs from TDT
by at most a few milliseconds.
TDB = TT + 0.001 658s * sin(g) + 0.000 014s * sin(2*g)
g = 357.53_d + 0.985 600 28_d * ( JD - 245 1545.0 )
(higher order terms neglected; g = Earth's mean anomaly)
TT = Terrestial Time. Originally used instead of TDT or TDB when the
difference between them didn't matter. Was defined in 1991 to be
consistent with the SI second and the General Theory of Relativity.
Replaced TDT in the ephemerides from 2001 and on.
TCG = Geocentric Coordinate Time. Defined in 1991 along with TT
TCB = Barycentric Coordinate Time. Defined in 1991 along with TT
delta-T =
ET - UT prior to 1984
TDT - UT 1984 - 2000
TT - UT from 2001 and on
delta-UT = UT - UTC
DUT = predicted value of delta-UT, rounded to 0.1s, given in some radio
time signals.
GPS time = TAI - 19 seconds. GPS time matched UTC from 1980-01-01
to 1981-07-01. No leap seconds are inserted into GPS time, thus
GPS time is 13 seconds ahead of UTC on 2000-01-01. The GPS epoch
is 00:00 (midnight) UTC on 1980-01-06.
The differences between GPS Time and International Atomic Time (TAI)
and Terrestrial Time (TT), also know as Terrestrial Dynamical Time
(TDT), are constant at the level of some tens of nanoseconds while
the difference between GPS Time and UTC changes in increments of
seconds each time a leap second is added to UTC time scale.
GPS week = a numbering of weeks starting at the GPS epoch 1980-01-06 00:00
GPS time (which back then was equal to UTC). Weeks are numbered from
0 and up until 1023, then it "rolls back" to 0 and are again numbered
from 0 and up, etc. One GPS week rollover cycle is therefore 1024
weeks = 7168 days = ca 19.62 years. So far there's been one such GPS
week number roll-over, on 1999-08-22 00:00 GPS time - a few older GPS
receivers then ceased to show the correct date.
ET 1960-1983 TDT 1984-2000
UTC 1972- GPS 1980- TAI 1958- TT 2001-
----+---------+-------------+-------------------------+-----
| | | |
|<------ TAI-UTC ------>|<----- TT-TAI ----->|
| | | 32.184s fixed |
|<GPS-UTC>|<- TAI-GPS ->| |
| | 19s fixed | |
| |
<> delta-UT = UT1-UTC |
| (max 0.9 sec) |
-----+------------------------------------------------+-----
|<-------------- delta-T = TT-UT1 -------------->|
UT1 (UT) TT/TDT/ET
Time zone
A time zone is a region that observes a uniform standard time for legal, commercial, and social purposes. Time zones tend
to follow the boundaries of countries and their subdivisions because it is convenient for areas in close commercial or other
communication to keep the same time.
Most of the time zones on land are offset from Coordinated Universal Time (UTC) by a whole number of hours (UTC−12 to UTC+14),
but a few are offset by 30 or 45 minutes (for example Newfoundland Standard Time is UTC -03:30 and Nepal Standard Time is
UTC +05:45). Some higher latitude countries use daylight saving time for part of the year, typically by changing clocks by an hour.
Many land time zones are skewed toward the west of the corresponding nautical time zones. This also creates a permanent
daylight saving time effect.
Time Zones And Daylight Savings Time
Locations
http://www.geonames.org/
http://download.geonames.org/export/dump/
The GeoNames geographical database covers all countries and contains over eight million placenames that are available
for download free of charge.
Timezones
tz Database
http://iana.org/time-zones/
Sources for Time Zone and Daylight Saving Time Data
http://www.twinsun.com/tz/tz-link.htm
ASCII Table
http://www.asciitable.com/
http://www.techonthenet.com/ascii/chart.php
http://www.globaliconnect.com/excel/index.php?option=com_content&view=article&id=115:excel-code-a-char-functions-vba-asc-a-chr-functions&catid=78&Itemid=474
Relational Operators
Relational operators compare two expressions of a similar type and evaluate to either .TRUE. or .FALSE.
Comparing Numbers Comparing Booleans
Operator Meaning Operator Meaning
EQ equal to EQV equivalent to
NE not equal to NEQV not equivalent to
LT less than
LE less than or equal to
GT greater than
GE greater than or equal to
Ref: http://www.obliquity.com/computer/fortran/operate.html
Date Sistems for Excel
Ref: Comment by Marc Kupper on
http://www.extendoffice.com/documents/excel/1423-excel-display-show-negative-time.html
The 1904 format comes from Excel version 1.0 which was on the Macintosh. Two years later Microsoft released Excel for Windows
and with with that release introduced the "1900" date format. Excel for the Mac continued to default to the 1904 format and
Windows defaults to the 1900 format. Both versions can switch to the other format but doing so will cause all dates in a workbook
to shift.
The year 1900 was special in that though it's divisible by 4 it was not a leap year. The Mac's clock hardware did not have the extra
logic needed to handle this special case and so Apple simplified the design by allowing for dates from 1904 (the first leap year in
the century) on out. As Excel was first written for the Mac it was natural that Excel would use the Mac's date format.
The developers of Excel for Windows used the 1900 format for backwards compatibility with SuperCalc and Lotus 1-2-3 which were
the dominate spreadsheet applications in the MS-DOS and Windows markets at the time.
The 1904 and 1900 formats are nearly identical. The 1904 format stores dates as the number of days since 1/1/1904 and the 1900
format is the number of days since 1/1/1900. You can convert a 1904 date to a 1900 date by adding 1,462 to a cell's value and
subtracting 1,462 to convert the other way.
Apparently the developers of Excel for the Mac included code to support negative time values. The coders of Excel for Windows
did not support negative time values. Modern versions of Excel still include two separate chunks of code with one dealing with
1904 dates and the other for 1900 dates. They never fixed the 1900 code to support display of negative time values.