das2C
das core C utilities (v3)
Loading...
Searching...
No Matches
Data Structures | Functions
time.h File Reference

Das Time Utilities. More...

#include <das3/defs.h>
Include dependency graph for time.h:
This graph shows which files directly or indirectly include this file:

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.
 

Detailed Description

Das Time Utilities.

Function Documentation

◆ tt2k_from_parts()

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.

Parameters
yearfour digit year, 1707 to 2292 (the TT2000 range)
month1 to 12
mdayday of month, or day of year when month is 1
hour0 to 23
minute0 to 59
second0 to 59, or 60 during a leap second
nanosecnanoseconds into the second, a caller with separate milli, micro and nano counts passes ms*1000000 + us*1000 + ns
pTTreceives the TT2000 value
Returns
DAS_OKAY, or DASERR_TIME for negative fields or a time outside the TT2000 range, in which case pTT is not written.

◆ tt2k_to_parts()

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.

Parameters
nTTnanoseconds since 2000-01-01T11:58:55.816 (TT2000)
pYear,pMonth,pMday,pHour,pMinute,pSecondreceive the calendar fields, month and mday 1 based
pNanosecreceives nanoseconds into the second, 0 to 999999999