logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

time.h.0p (9262B)


  1. '\" et
  2. .TH time.h "0P" 2017 "IEEE/The Open Group" "POSIX Programmer's Manual"
  3. .\"
  4. .SH PROLOG
  5. This manual page is part of the POSIX Programmer's Manual.
  6. The Linux implementation of this interface may differ (consult
  7. the corresponding Linux manual page for details of Linux behavior),
  8. or the interface may not be implemented on Linux.
  9. .\"
  10. .SH NAME
  11. time.h
  12. \(em time types
  13. .SH SYNOPSIS
  14. .LP
  15. .nf
  16. #include <time.h>
  17. .fi
  18. .SH DESCRIPTION
  19. Some of the functionality described on this reference page extends the
  20. ISO\ C standard. Applications shall define the appropriate feature test macro
  21. (see the System Interfaces volume of POSIX.1\(hy2017,
  22. .IR "Section 2.2" ", " "The Compilation Environment")
  23. to enable the visibility of these symbols in this header.
  24. .P
  25. The
  26. .IR <time.h>
  27. header shall define the
  28. .BR clock_t ,
  29. .BR size_t ,
  30. .BR time_t ,
  31. types as described in
  32. .IR <sys/types.h> .
  33. .P
  34. The
  35. .IR <time.h>
  36. header shall define the
  37. .BR clockid_t
  38. and
  39. .BR timer_t
  40. types as described in
  41. .IR <sys/types.h> .
  42. .P
  43. The
  44. .IR <time.h>
  45. header shall define the
  46. .BR locale_t
  47. type as described in
  48. .IR <locale.h> .
  49. .P
  50. The
  51. .IR <time.h>
  52. header shall define the
  53. .BR pid_t
  54. type as described in
  55. .IR <sys/types.h> .
  56. .P
  57. The tag
  58. .BR sigevent
  59. shall be declared as naming an incomplete structure type, the contents
  60. of which are described in the
  61. .IR <signal.h>
  62. header.
  63. .P
  64. The
  65. .IR <time.h>
  66. header shall declare the
  67. .BR tm
  68. structure, which shall include at least the following members:
  69. .sp
  70. .RS 4
  71. .nf
  72. int tm_sec \fRSeconds [0,60].\fR
  73. int tm_min \fRMinutes [0,59].\fR
  74. int tm_hour \fRHour [0,23].\fR
  75. int tm_mday \fRDay of month [1,31].\fR
  76. int tm_mon \fRMonth of year [0,11].\fR
  77. int tm_year \fRYears since 1900.\fR
  78. int tm_wday \fRDay of week [0,6] (Sunday =0).\fR
  79. int tm_yday \fRDay of year [0,365].\fR
  80. int tm_isdst \fRDaylight Savings flag.\fR
  81. .fi
  82. .P
  83. .RE
  84. .P
  85. The value of
  86. .IR tm_isdst
  87. shall be positive if Daylight Savings Time is in effect, 0 if Daylight
  88. Savings Time is not in effect, and negative if the information is not
  89. available.
  90. .P
  91. The
  92. .IR <time.h>
  93. header shall declare the
  94. .BR timespec
  95. structure, which shall include at least the following members:
  96. .sp
  97. .RS 4
  98. .nf
  99. time_t tv_sec \fRSeconds.\fR
  100. long tv_nsec \fRNanoseconds.\fR
  101. .fi
  102. .P
  103. .RE
  104. .P
  105. The
  106. .IR <time.h>
  107. header shall also declare the
  108. .BR itimerspec
  109. structure, which shall include at least the following members:
  110. .sp
  111. .RS 4
  112. .nf
  113. struct timespec it_interval \fRTimer period.\fR
  114. struct timespec it_value \fRTimer expiration.\fR
  115. .fi
  116. .P
  117. .RE
  118. .P
  119. The
  120. .IR <time.h>
  121. header shall define the following macros:
  122. .IP NULL 14
  123. As described in
  124. .IR <stddef.h> .
  125. .IP CLOCKS_PER_SEC 14
  126. A number used to convert the value returned by the
  127. \fIclock\fR()
  128. function into seconds. The value shall be an expression with type
  129. .BR clock_t .
  130. The value of CLOCKS_PER_SEC shall be 1 million
  131. on XSI-conformant systems. However, it may be variable on other systems,
  132. and it should not be assumed that CLOCKS_PER_SEC is a compile-time
  133. constant.
  134. .P
  135. The
  136. .IR <time.h>
  137. header shall define the following symbolic constants. The values shall
  138. have a type that is assignment-compatible with
  139. .BR clockid_t .
  140. .IP CLOCK_MONOTONIC 14
  141. .br
  142. The identifier for the system-wide monotonic clock, which is defined as
  143. a clock measuring real time, whose value cannot be set via
  144. \fIclock_settime\fR()
  145. and which cannot have negative clock jumps. The maximum possible clock
  146. jump shall be implementation-defined.
  147. .IP CLOCK_PROCESS_CPUTIME_ID 14
  148. .br
  149. The identifier of the CPU-time clock associated with the process
  150. making a
  151. \fIclock\fR()
  152. or
  153. .IR timer* (\|)
  154. function call.
  155. .IP CLOCK_REALTIME 14
  156. The identifier of the system-wide clock measuring real time.
  157. .IP CLOCK_THREAD_CPUTIME_ID 14
  158. .br
  159. The identifier of the CPU-time clock associated with the thread making a
  160. \fIclock\fR()
  161. or
  162. .IR timer* (\|)
  163. function call.
  164. .P
  165. The
  166. .IR <time.h>
  167. header shall define the following symbolic constant:
  168. .IP TIMER_ABSTIME 14
  169. Flag indicating time is absolute. For functions taking timer objects,
  170. this refers to the clock associated with the timer.
  171. .P
  172. The
  173. .IR <time.h>
  174. header shall provide a declaration or definition for
  175. .IR getdate_err .
  176. The
  177. .IR getdate_err
  178. symbol shall expand to an expression of type
  179. .BR int .
  180. It is unspecified whether
  181. .IR getdate_err
  182. is a macro or an identifier declared with external linkage, and whether or
  183. not it is a modifiable lvalue. If a macro definition is suppressed in
  184. order to access an actual object, or a program defines an identifier
  185. with the name
  186. .IR getdate_err ,
  187. the behavior is undefined.
  188. .P
  189. The following shall be declared as functions and may also be defined
  190. as macros. Function prototypes shall be provided.
  191. .sp
  192. .RS 4
  193. .nf
  194. char *asctime(const struct tm *);
  195. char *asctime_r(const struct tm *restrict, char *restrict);
  196. clock_t clock(void);
  197. int clock_getcpuclockid(pid_t, clockid_t *);
  198. int clock_getres(clockid_t, struct timespec *);
  199. int clock_gettime(clockid_t, struct timespec *);
  200. int clock_nanosleep(clockid_t, int, const struct timespec *,
  201. struct timespec *);
  202. int clock_settime(clockid_t, const struct timespec *);
  203. char *ctime(const time_t *);
  204. char *ctime_r(const time_t *, char *);
  205. double difftime(time_t, time_t);
  206. struct tm *getdate(const char *);
  207. struct tm *gmtime(const time_t *);
  208. struct tm *gmtime_r(const time_t *restrict, struct tm *restrict);
  209. struct tm *localtime(const time_t *);
  210. struct tm *localtime_r(const time_t *restrict, struct tm *restrict);
  211. time_t mktime(struct tm *);
  212. int nanosleep(const struct timespec *, struct timespec *);
  213. size_t strftime(char *restrict, size_t, const char *restrict,
  214. const struct tm *restrict);
  215. size_t strftime_l(char *restrict, size_t, const char *restrict,
  216. const struct tm *restrict, locale_t);
  217. char *strptime(const char *restrict, const char *restrict,
  218. struct tm *restrict);
  219. time_t time(time_t *);
  220. int timer_create(clockid_t, struct sigevent *restrict,
  221. timer_t *restrict);
  222. int timer_delete(timer_t);
  223. int timer_getoverrun(timer_t);
  224. int timer_gettime(timer_t, struct itimerspec *);
  225. int timer_settime(timer_t, int, const struct itimerspec *restrict,
  226. struct itimerspec *restrict);
  227. void tzset(void);
  228. .fi
  229. .P
  230. .RE
  231. .br
  232. .P
  233. The
  234. .IR <time.h>
  235. header shall declare the following as variables:
  236. .sp
  237. .RS 4
  238. .nf
  239. extern int daylight;
  240. extern long timezone;
  241. extern char *tzname[];
  242. .fi
  243. .P
  244. .RE
  245. .P
  246. Inclusion of the
  247. .IR <time.h>
  248. header may make visible all symbols from the
  249. .IR <signal.h>
  250. header.
  251. .LP
  252. .IR "The following sections are informative."
  253. .SH "APPLICATION USAGE"
  254. The range [0,60] for
  255. .IR tm_sec
  256. allows for the occasional leap second.
  257. .P
  258. .IR tm_year
  259. is a signed value; therefore, years before 1900 may be represented.
  260. .P
  261. To obtain the number of clock ticks per second returned by the
  262. \fItimes\fR()
  263. function, applications should call
  264. .IR sysconf (_SC_CLK_TCK).
  265. .SH RATIONALE
  266. The range [0,60] seconds allows for positive or negative leap seconds.
  267. The formal definition of UTC does not permit double leap seconds, so
  268. all mention of double leap seconds has been removed, and the range
  269. shortened from the former [0,61] seconds seen in earlier versions of
  270. this standard.
  271. .SH "FUTURE DIRECTIONS"
  272. None.
  273. .SH "SEE ALSO"
  274. .IR "\fB<locale.h>\fP",
  275. .IR "\fB<signal.h>\fP",
  276. .IR "\fB<stddef.h>\fP",
  277. .IR "\fB<sys_types.h>\fP"
  278. .P
  279. .ad l
  280. The System Interfaces volume of POSIX.1\(hy2017,
  281. .IR "Section 2.2" ", " "The Compilation Environment",
  282. .IR "\fIasctime\fR\^(\|)",
  283. .IR "\fIclock\fR\^(\|)",
  284. .IR "\fIclock_getcpuclockid\fR\^(\|)",
  285. .IR "\fIclock_getres\fR\^(\|)",
  286. .IR "\fIclock_nanosleep\fR\^(\|)",
  287. .IR "\fIctime\fR\^(\|)",
  288. .IR "\fIdifftime\fR\^(\|)",
  289. .IR "\fIgetdate\fR\^(\|)",
  290. .IR "\fIgmtime\fR\^(\|)",
  291. .IR "\fIlocaltime\fR\^(\|)",
  292. .IR "\fImktime\fR\^(\|)",
  293. .IR "\fImq_receive\fR\^(\|)",
  294. .IR "\fImq_send\fR\^(\|)",
  295. .IR "\fInanosleep\fR\^(\|)",
  296. .IR "\fIpthread_getcpuclockid\fR\^(\|)",
  297. .IR "\fIpthread_mutex_timedlock\fR\^(\|)",
  298. .IR "\fIpthread_rwlock_timedrdlock\fR\^(\|)",
  299. .IR "\fIpthread_rwlock_timedwrlock\fR\^(\|)",
  300. .IR "\fIsem_timedwait\fR\^(\|)",
  301. .IR "\fIstrftime\fR\^(\|)",
  302. .IR "\fIstrptime\fR\^(\|)",
  303. .IR "\fIsysconf\fR\^(\|)",
  304. .IR "\fItime\fR\^(\|)",
  305. .IR "\fItimer_create\fR\^(\|)",
  306. .IR "\fItimer_delete\fR\^(\|)",
  307. .IR "\fItimer_getoverrun\fR\^(\|)",
  308. .IR "\fItzset\fR\^(\|)",
  309. .IR "\fIutime\fR\^(\|)"
  310. .ad b
  311. .\"
  312. .SH COPYRIGHT
  313. Portions of this text are reprinted and reproduced in electronic form
  314. from IEEE Std 1003.1-2017, Standard for Information Technology
  315. -- Portable Operating System Interface (POSIX), The Open Group Base
  316. Specifications Issue 7, 2018 Edition,
  317. Copyright (C) 2018 by the Institute of
  318. Electrical and Electronics Engineers, Inc and The Open Group.
  319. In the event of any discrepancy between this version and the original IEEE and
  320. The Open Group Standard, the original IEEE and The Open Group Standard
  321. is the referee document. The original Standard can be obtained online at
  322. http://www.opengroup.org/unix/online.html .
  323. .PP
  324. Any typographical or formatting errors that appear
  325. in this page are most likely
  326. to have been introduced during the conversion of the source files to
  327. man page format. To report such errors, see
  328. https://www.kernel.org/doc/man-pages/reporting_bugs.html .