structs_type_time
—
structs types for time values
PDEL Library (libpdel, -lpdel)
#include <sys/types.h>
#include
<pdel/structs/structs.h>
#include
<pdel/structs/type/time.h>
extern const struct structs_type
structs_type_time_gmt;
extern const struct structs_type
structs_type_time_local;
extern const struct structs_type
structs_type_time_iso8601;
extern const struct structs_type structs_type_time_abs;
extern const struct structs_type
structs_type_time_rel;
The
structs(3)
library includes several pre-defined types for time values. All of the types
below describe a variable of type time_t
, which holds
the number of seconds since Jan 1, 1970 00:00:00 GMT.
The only difference between the types below is how the ASCII form
of a time value is represented.
- structs_type_time_gmt
- Displays the time in
ctime(3)
GMT format, e.g., "Mon Apr 22 19:50:00 GMT 2002".
- structs_type_time_local
- Displays the time in
ctime(3)
local timezone format, but without the timezone explicitly shown, e.g.,
"Mon Apr 22 12:50:00 2002". Warning: This type
should be avoided except where it is known that both the encoding and
decoding time zones are the same.
- structs_type_time_iso8601
- Displays the time in ISO-8601 format, e.g.,
"20020422T19:50:00".
- structs_type_time_abs
- Displays the time in seconds since Jan 1, 1970 GMT, e.g.,
"1019505000".
- structs_type_time_rel
- Displays the time in seconds relative to now, e.g., "10413".
Warning: The longer the time between ASCII encoding and
decoding, the more erroneous the value becomes.
The PDEL library was developed at Packet Design, LLC.
http://www.packetdesign.com/
Archie Cobbs ⟨archie@freebsd.org⟩