caltime

## Name

caltime — calendar dates and times

## Synopsis

    #include <caltime.h>

    unsigned int \fBcaltime_fmt\fP(\fIs\fR,&\fIct\fR);

    unsigned int \fBcaltime_scan\fP(\fIs\fR,&\fIct\fR);

    struct caltime \fIct\fR;

    char *\fIs\fR;

## Description

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\fR), 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).

## Formatting

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.

## See also

caltime_tai(3)
caldate(3)
tai(3)

## Author

Original code and documentation by Daniel J. Bernstein. Converted to DocBook XML by Jonathan de Boyne Pollard.