The CDF_TT2000 procedure computes or breaks down CDF_TIME_TT2000 values in a CDF file. When computing an epoch, any missing value is considered to be zero. The Epoch value is the number of nanoseconds since J2000 (2000-01-01T12:00:00.000000000) with leap seconds included.
Tip: See the CDF_LEAPSECONDS_INFO routine for up-to-date info on current leap seconds.
If you supply a value for the Epoch argument and set the BREAKDOWN_EPOCH keyword, CDF_TT2000 will compute the values of the Year, Month, Day, etc. and insert the values into the named variables you supply. If you specify the Year (and optionally, the Month, Day, etc.) and set the COMPUTE_EPOCH keyword, CDF_TT2000 will compute the epoch and place the value in the named variable supplied as the Epoch parameter.
Note: You must set either the BREAKDOWN_EPOCH or COMPUTE_EPOCH keyword.
Examples
Compute a single epoch value of 19 January 2038 at 03:14:07.121243999:
IDL> CDF_TT2000, epoch, 2038, 1, 19, 3, 14, 07, 121, 243, 999, /COMPUTE_EPOCH
IDL> epoch
1200755716305243999
Break down the given epoch value into standard date components:
IDL> CDF_TT2000, epoch, yy, mm, dd, hh, mn, ss, ms, us, ns, /BREAKDOWN
IDL> fix([yy, mm, dd, hh, mn, ss, ms, us, ns])
2038 1 19 3 14 7 121 243 999
To compute an array of epoch values from the following three dates:
20-Sep-2005 03:05:46:156.111.222
20-Sep-2005 03:06:22:234.333.444
20-Sep-2005 03:07:12:345.555.666
IDL> yy = [2005, 2005, 2005] & mm = [9, 9, 9] & dd = [20, 20, 20]
IDL> hh = [3, 3, 3] & mn = [5, 6, 7] & ss = [46, 22, 12]
IDL> ms = [156, 234, 345] & us = [111, 333, 555] & ns = [222, 444, 666]
IDL> CDF_TT2000, epoch2, yy, mm, dd, hh, mn, ss, ms, us, ns, /COMPUTE_EPOCH
IDL> epoch2
180457610340111222 180457646418333444 180457696529555666
Since the year, month, day, hour fields are the same, the above command can also be written as:
CDF_TT2000, epoch2, 2005, 9, 20, 3, mn, ss, ms, us, ns, /COMPUTE_EPOCH
To break down the above epoch values into standard date components:
CDF_TT2000, epoch2, yr, mo, dy, hr, min, sec, milli, micro, nano, /BREAK
All yr, mo, dy, hr, min, sec, milli, micro, nano fields will be three-element arrays.
Now compute the epoch for a recent leap second, and convert back to verify that seconds = 60:
IDL> CDF_TT2000, epoch3, 2016, 12, 31, 23, 59, 60, 0, 0, 0, /COMPUTE_EPOCH
IDL> epoch3
536500868184000000
IDL> CDF_TT2000, epoch3, yy, mm, dd, hh, mn, ss, ms, us, ns, /BREAKDOWN
IDL> fix([yy, mm, dd, hh, mn, ss, ms, us, ns])
2016 12 31 23 59 60 0 0 0
Syntax
CDF_TT2000, Epoch, Year, Month, Day [, Hour, Minute, Second, Milli, Micro, Nano] [, /BREAKDOWN_EPOCH] [, /COMPUTE_EPOCH] [, /TOINTEGER]
Arguments
Epoch
The Epoch value to be broken down, or a named variable that will contain the computed epoch. The Epoch value is the number of nanoseconds since J2000 (2000-01-01T12:00:00.000000000) with leap seconds included.
Note: CDF_TIME_TT2000 is based on J2000. It can only cover +/- 292 years from J2000. To convert CDF TT2000 epochs into date/times and vice versa, you should only use the CDF_TT2000 routine with either the BREAKDOWN_EPOCH or COMPUTE_EPOCH keyword.
Year
If COMPUTE_EPOCH is set, a four-digit integer or array of integers representing the year, such as 2112. The valid range is 1708 to 2291.
If BREAKDOWN_EPOCH is set, a named variable that will contain the year.
Month
If COMPUTE_EPOCH is set, an integer between 1 and 12 representing the month. Alternately, you can set Month equal to zero, in which case the Day argument can take on a Day of the Year value between 1 and 366.
If BREAKDOWN_EPOCH is set, a named variable that will contain the numeric month value in the range 1–12.
Day
If COMPUTE_EPOCH is set, an integer between 1 and 31 representing the day of the month. Alternately, if the Month argument is set equal to zero, Day can be an integer between 1-366 representing the day of the year.
If BREAKDOWN_EPOCH is set, a named variable that will contain the numeric day of the month value in the range 1–31.
Hour
If COMPUTE_EPOCH is set, an integer between 0 and 23 representing the hour of the day.
If BREAKDOWN_EPOCH is set, a named variable that will contain the numeric hour of the day value in the range 0–23.
Note: Values greater than 23 will quietly wrap around to the following day(s).
Minute
If COMPUTE_EPOCH is set, an integer between 0 and 59 representing the minute of the hour.
If BREAKDOWN_EPOCH is set, a named variable that will contain the numeric minute of the hour value in the range 0–59.
Note: Values greater than 59 will quietly wrap around to the following hour(s).
Second
If COMPUTE_EPOCH is set, an integer between 0 and 59 representing the second of the minute. A value of 60 is also allowed to account for leap seconds.
If BREAKDOWN_EPOCH is set, a named variable that will contain the numeric second of the minute value in the range 0–59 (or 60 for a leap second).
Note: Values greater than 59 (or 60 for a leap second) will quietly wrap around to the following minute(s).
Milli
If COMPUTE_EPOCH is set, an integer between 0 and 999 representing the millisecond. Alternately, if the Hour, Minute, and Second arguments are set all equal to zero, Milli can be an integer between 0-86400000 representing the millisecond of the day.
If BREAKDOWN_EPOCH is set, a named variable that will contain the numeric millisecond value in the range 0–999.
Note: Values greater than 999 will quietly wrap around to the following second(s).
Micro
If COMPUTE_EPOCH is set, an integer between 0 and 999 representing the microsecond. Alternately, if the Hour, Minute, and Second arguments are set all equal to zero, Micro can be an integer between 0-86400000000 representing the microsecond of the day.
If BREAKDOWN_EPOCH is set, a named variable that will contain the numeric microsecond value in the range 0–999.
Note: Values greater than 999 will quietly wrap around to the following millisecond(s).
Nano
If COMPUTE_EPOCH is set, an integer between 0 and 999 representing the millisecond. Alternately, if the Hour, Minute, and Second arguments are set all equal to zero, Nano can be an integer between 0-86400000000000 representing the nanosecond of the day.
If BREAKDOWN_EPOCH is set, a named variable that will contain the numeric nanosecond value in the range 0–999.
Note: Values greater than 999 will quietly wrap around to the following microsecond(s).
Keywords
BREAKDOWN_EPOCH
Set this keyword to break down the value of the Epoch argument into its component parts, storing the resulting year, month, day, etc. values in the variables specified by the corresponding arguments.
COMPUTE_EPOCH
Set this keyword to compute the value of Epoch from the values specified by the Year, Month, Day, etc. arguments.
TOINTEGER
Set this keyword when an epoch value is broken down to date/time components (with BREAKDOWN_EPOCH keyword). If this keyword is set, all components will be integers, instead of their default of doubles.
Version History
See Also
CDF_ENCODE_TT2000, CDF_PARSE_TT2000, CDF_LEAPSECONDS_INFO