-
-
Notifications
You must be signed in to change notification settings - Fork 3
caltime.3
caltime - calendar dates and times
#include <caltime.h>
unsigned int caltime_fmt(s,&ct);
unsigned int caltime_scan(s,&ct);
struct caltime ct;
char *s;
A struct caltime value is a calendar date and time with an offset in minutes from UTC. It has five components: date (a struct caldate), hour (0...23), minute (0...59), second (0...60), and offset (-5999...5999).
For example, a leap second occurred on 30 June 1997 at 23:59:60 UTC. The local time in New York was 30 June 1997 19:59:60 -0400. This local time is represented inside a struct caltime with date containing 1997, 6, 30; hour 19; minute 59; second 60; and offset -240 (4 hours).
caltime_fmt prints ct in ISO style (yyyy-mm-dd hh:mm:ss +oooo) into the character buffer s, without a terminating NUL. It returns the number of characters printed. s may be zero; then caltime_fmt returns the number of characters that would have been printed.
caltime_scan reads a calendar date, time, and offset in ISO style from the beginning of the character buffer s and puts them into ct. It returns the number of characters read. If s does not start with an ISO-style date and time (including offset), caltime_scan returns 0.