tpf_STCKE_to_timet: Convert tpf_TOD_ext_type to time_t
This function converts a z/TPF extended time-of-day (TOD) clock timestamp to time_t format.
Last updated
Added in 2023.
Format
#include <tpf/c_stcke.h>
int tpf_STCKE_to_timet(tpf_TOD_ext_type* tod_in, time_t* t_out);
- tod_in
- A pointer to the extended TOD clock timestamp to convert to time_t format.
- t_out
- A pointer to a time_t value, which is the result of the conversion. The value is truncated to the latest second.
Normal return
A value of STCKE_CNV_OK or 0 is returned.
Error return
| Return label | Return value | Description |
|---|---|---|
| STCKE_CNV_NULL | -2 | The tod_in or t_out parameter is a null pointer. |
Programming considerations
The first byte of the tpf_TOD_ext_type data structure, which represents the epoch, is taken into account, so timestamps beyond 2042-09-17 23:53:47 are converted to the correct time_t values.
Examples
The following example converts an extended TOD clock timestamp to its corresponding time_t
value.
#include <tpf/c_stcke.h>
tpf_TOD_ext_type tod_val;
time_t timet_result;
tpf_STCKE(&tod_val);
int rc = tpf_STCKE_to_timet(&tod_val, &timet_result);