![]() |
das2C
das core C utilities (v3)
|
Das Time Utilities. More...
#include <das3/defs.h>

Go to the source code of this file.
Data Structures | |
| struct | das_time |
| Basic date-time structure used throughout the Das1 & Das2 utilities. More... | |
Functions | |
| DAS_API DasErrCode | tt2k_from_parts (int year, int month, int mday, int hour, int minute, int second, int32_t nanosec, int64_t *pTT) |
| Convert broken out UTC fields to TT2000, without floating point seconds. | |
| DAS_API void | tt2k_to_parts (int64_t nTT, int *pYear, int *pMonth, int *pMday, int *pHour, int *pMinute, int *pSecond, int32_t *pNanosec) |
| Break a TT2000 time into UTC fields, without floating point seconds. | |
Das Time Utilities.
| DAS_API DasErrCode tt2k_from_parts | ( | int | year, |
| int | month, | ||
| int | mday, | ||
| int | hour, | ||
| int | minute, | ||
| int | second, | ||
| int32_t | nanosec, | ||
| int64_t * | pTT | ||
| ) |
Convert broken out UTC fields to TT2000, without floating point seconds.
For sources that already hold integer sub-second counts. A das_time keeps seconds as a double, so going through dt_to_tt2k() would pack them into a double just to split them again.
nanosec may pass a second and carries leap second aware: second 59 plus 1500000000 ns at 2016-12-31T23:59 is the leap second 23:59:60.5. Month 1 with mday as the day of year also works.
| year | four digit year, 1707 to 2292 (the TT2000 range) |
| month | 1 to 12 |
| mday | day of month, or day of year when month is 1 |
| hour | 0 to 23 |
| minute | 0 to 59 |
| second | 0 to 59, or 60 during a leap second |
| nanosec | nanoseconds into the second, a caller with separate milli, micro and nano counts passes ms*1000000 + us*1000 + ns |
| pTT | receives the TT2000 value |
| DAS_API void tt2k_to_parts | ( | int64_t | nTT, |
| int * | pYear, | ||
| int * | pMonth, | ||
| int * | pMday, | ||
| int * | pHour, | ||
| int * | pMinute, | ||
| int * | pSecond, | ||
| int32_t * | pNanosec | ||
| ) |
Break a TT2000 time into UTC fields, without floating point seconds.
The inverse of tt2k_from_parts(). During a leap second the second field is 60. Any output pointer may be NULL to skip that field.
| nTT | nanoseconds since 2000-01-01T11:58:55.816 (TT2000) |
| pYear,pMonth,pMday,pHour,pMinute,pSecond | receive the calendar fields, month and mday 1 based |
| pNanosec | receives nanoseconds into the second, 0 to 999999999 |