scc

A fork of https://git.simple-cc.org/scc/ for Qute

git clone https://git.8pit.net/scc.git

  1.TH CTIME 3 scc\-VERSION
  2.SH NAME
  3asctime, ctime, gmtime, localtime, mktime - convert between calendar time and broken-down time
  4.SH SYNOPSIS
  5#include <time.h>
  6
  7.nf
  8char *asctime(const struct tm *tm);
  9char *ctime(const time_t *timep);
 10struct tm *gmtime(const time_t *timep);
 11struct tm *localtime(const time_t *timep);
 12time_t mktime(struct tm *tm);
 13.fi
 14.SH DESCRIPTION
 15The
 16.BR ctime ,
 17.B gmtime
 18and
 19.B localtime
 20functions each accept a
 21.B time_t
 22argument representing calendar time.
 23
 24The
 25.B asctime
 26and
 27.B mktime
 28functions each accept a pointer to a broken-down time structure,
 29which separates calendar time into components such as
 30year, month, and day.
 31
 32Broken-down time is stored in a
 33.B struct tm
 34object.
 35
 36Calling
 37.B ctime(t)
 38is equivalent to calling
 39.BR asctime(localtime(t)) .
 40It converts the calendar time
 41.I t
 42to a null-terminated string with the form:
 43
 44	"Wed Jun 30 21:49:08 1993\n\0"
 45
 46In the C locale, the day-of-week abbreviations are
 47"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", and "Sat";
 48the month abbreviations are "Jan", "Feb", "Mar", "Apr",
 49"May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", and "Dec".
 50
 51The
 52.B gmtime
 53function converts the calendar time
 54.I timep
 55to a broken-down time expressed as
 56Coordinated Universal Time (UTC).
 57It may return NULL when the conversion is not possible.
 58
 59The
 60.B localtime
 61function converts the calendar time
 62.I timep
 63to a broken-down time expressed in the user's local timezone.
 64
 65The
 66.B asctime
 67function converts the broken-down time
 68.I tm
 69to a null-terminated string using the same format as
 70.BR ctime .
 71
 72The
 73.B mktime
 74function converts a broken-down local time to a calendar time value.
 75The
 76.B tm_wday
 77and
 78.B tm_yday
 79fields of the input structure are ignored.
 80The remaining fields are not required to lie within their normal ranges.
 81Upon success, the structure is updated so that all fields reflect
 82the calendar time within their standard ranges,
 83with
 84.B tm_wday
 85and
 86.B tm_yday
 87computed accordingly.
 88The final value of
 89.B tm_mday
 90is resolved only after
 91.B tm_mon
 92and
 93.B tm_year
 94have been determined.
 95
 96.SH RETURN VALUE
 97On success,
 98.B gmtime
 99and
100.B localtime
101return a pointer to a
102.B struct tm .
103
104On success,
105.B asctime
106and
107.B ctime
108return a pointer to the formatted string.
109
110On success,
111.B mktime
112returns the calendar time as a
113.B time_t
114value.
115
116On failure,
117.B mktime
118returns
119.BR (time_t)-1 .
120All other functions return NULL on failure.
121On error,
122.B errno
123is set to indicate the cause.
124.SH STANDARDS
125.nf
126ISO/IEC 9899:1999 7.23.2.3 Paragraph 1,2,3
127ISO/IEC 9899:1999 7.23.3.1 Paragraph 1,2,3
128ISO/IEC 9899:1999 7.23.3.2 Paragraph 1,2,3
129ISO/IEC 9899:1999 7.23.3.3 Paragraph 1,2,3
130ISO/IEC 9899:1999 7.23.3.4 Paragraph 1,2,3
131.fi
132.SH SEE ALSO
133.BR time.h (3)