A small set of routines for manipulating the dates used in GCF block headers. GCF dates are encoded into a 32-bit field, the top 15 bits of which represent the number of days elasped since 1989-11-17, and the bottom 17 bits of which represent the number of seconds elapsed that day since 00:00:00. Both ISO8601 and GCF time deal correctly with leap seconds.
int gcf_date_decode |
( |
struct iso8601_date * |
iso_date, |
|
|
uint32_t |
gcf_date |
|
) |
| |
Decode a GCF date.
- Parameters
-
[out] | iso_date | The ISO8601 date. |
| gcf_date | The date (32-bit encoded value) to decode. |
- Return values
-
This function will decode a GCF encoded date gcf_date and store the result in iso_date, also validating it.
int gcf_date_encode |
( |
uint32_t * |
gcf_date, |
|
|
const struct iso8601_date * |
iso_date |
|
) |
| |
Encode a GCF date.
- Parameters
-
[out] | gcf_date | The 32-bit encoded date is written here. |
| iso_date | The ISO8601 date to encode. |
- Return values
-
This function will encode an ISO8601 date iso_date, storing the result in gcf_date. It will fail if the date in iso_date is outside the range that can be represented by GCF dates. Any nanosecond component of iso_date is ignored.