CDF_EPOCH_UNIXTIME ================== The CDF_EPOCH_UNIXTIME function converts time(s) in CDF_EPOCH, CDF_EPOCH16 or CDF_TIME_TT2000 (TT2000) to/from Unix time(s). The source time(s) can be a scalar or array. The CDF_EPOCH time is milliseconds from 0000-01-01 00:00:00.000 in idl double. The CDF_EPOCH16 (long epoch) time is picoseconds from 0000-01-01 00:00:00.000 in idl double complex. The TT2000 time in nanoseconds from J2000 with leap seconds in idl long64. The unix time is seconds from 1970-01-01 00:00:00 in idl double. The Unix time can have sub-second, with a time resolution of microseconds, in its fractional part. Note: Since TT2000 and CDF_EPOCH16 has higher time resolution, the converted time might not preserve the full resolution for sub-microseconds. CDF_EPOCH does not have the time resolution for microseconds. The conversion will not preserve it if the Unix time has that. Examples To convert the CDF_EPOCH times at 1969-12-31T23:59:59.000, 1970-01-01T00:00:00.000 and 1970-01-01T00:00:01.000 to their corresponding unix times. V3 = CDF_PARSE_EPOCH (['1969-12-31T23:59:59.000','1970-01-01T00:00:00.000',$ '1970-01-01T00:00:01.000']) help, V3 V3 DOUBLE = Array[3] unixtimes = CDF_EPOCH_UNIXTIME (V3) print, unixtimes -1.0000000 0.0000000 1.0000000 To convert unix times back to CDF_EPOCH: E3 = CDF_EPOCH_UNIXTIME (unixtimes, /EPOCH) print, CDF_ENCODE_EPOCH(E3) 1969-12-31T23:59:59.000 1970-01-01T00:00:00.000 1970-01-01T00:00:01.000 To convert the same unix times to TT2000: T3 = CDF_EPOCH_UNIXTIME (unixtimes, /TT2000) help, T3 T3 LONG64 = Array[3] print, CDF_ENCODE_TT2000(T3) 1969-12-31T23:59:59.000000000 1970-01-01T00:00:00.000000000 1970-01-01T00:00:01.000000000 To convert the same unix times to CDF_EPOCH16: TT2000 = CDF_EPOCH_UNIXTIME (unixtimes, /LONGEPOCH) help, TT2000 TT2000 DCOMPLEX = Array[3] print, CDF_ENCODE_TT2000(TT2000) 1969-12-31T23:59:59.000000000000 1970-01-01T00:00:00.000000000000 1970-01-01T00:00:01.000000000000 Syntax Result = CDF_EPOCH_UNIXTIME (Time [, /EPOCH] [, /LONGEPOCH] $ [, /TT2000]) Arguments Time The time, unix time or CDF based time, to be converted. It can be a scalar value or an array of values. Without any keyword, it is converting a CDF based time(s) to unix time(s). Keywords EPOCH Set this keyword to convert a unix time(s) to a CDF_EPOCH data type time(s). LONGEPOCH Set this keyword to convert a unix time(s) to a CDF_EPOCH16 data type time(s). TT2000 Set this keyword to convert a unix time(s) to a CDF's TT2000 data type time(s). Version History Pre 4.0 Introduced © 2015 Exelis Visual Information Solutions, Inc., a subsidiary of Harris Corporation. All Rights Reserved. This information is not subject to the controls of the International Traffic in Arms Regulations (ITAR) or the Export Administration Regulations (EAR). However, this information may be restricted from transfer to various embargoed countries under U.S. laws and regulations.