[6c914e9] | 1 | @c |
---|
| 2 | @c COPYRIGHT (c) 1988-1998. |
---|
| 3 | @c On-Line Applications Research Corporation (OAR). |
---|
| 4 | @c All rights reserved. |
---|
| 5 | @c |
---|
| 6 | @c $Id$ |
---|
| 7 | @c |
---|
| 8 | |
---|
| 9 | @chapter Clock Manager |
---|
[4ebb4862] | 10 | |
---|
[6c914e9] | 11 | @section Introduction |
---|
| 12 | |
---|
| 13 | The clock manager ... |
---|
| 14 | |
---|
| 15 | The directives provided by the clock manager are: |
---|
| 16 | |
---|
| 17 | @itemize @bullet |
---|
| 18 | @item @code{clock_gettime} - |
---|
| 19 | @item @code{clock_settime} - |
---|
| 20 | @item @code{clock_getres} - |
---|
[d7fcc1d] | 21 | @item @code{sleep} - Delay Process Execution |
---|
[6c914e9] | 22 | @item @code{nanosleep} - |
---|
[f1ccfde] | 23 | @item @code{gettimeofday} - Get the Time of Day |
---|
| 24 | @item @code{time} - Get time in seconds |
---|
| 25 | @item @code{times} - Get process times |
---|
[6c914e9] | 26 | @end itemize |
---|
| 27 | |
---|
| 28 | @section Background |
---|
| 29 | |
---|
[d7fcc1d] | 30 | There is currently no text in this section. |
---|
| 31 | |
---|
[6c914e9] | 32 | @section Operations |
---|
| 33 | |
---|
[d7fcc1d] | 34 | There is currently no text in this section. |
---|
| 35 | |
---|
[6c914e9] | 36 | @section Directives |
---|
| 37 | |
---|
| 38 | This section details the clock manager's directives. |
---|
| 39 | A subsection is dedicated to each of this manager's directives |
---|
| 40 | and describes the calling sequence, related constants, usage, |
---|
| 41 | and status codes. |
---|
| 42 | |
---|
[d7fcc1d] | 43 | @subsection clock_gettime - |
---|
[6c914e9] | 44 | |
---|
| 45 | @subheading CALLING SEQUENCE: |
---|
| 46 | |
---|
| 47 | @example |
---|
| 48 | #include <time.h> |
---|
| 49 | |
---|
| 50 | int clock_gettime( |
---|
| 51 | clockid_t clock_id, |
---|
| 52 | struct timespec *tp |
---|
| 53 | ); |
---|
| 54 | @end example |
---|
| 55 | |
---|
| 56 | @subheading STATUS CODES: |
---|
| 57 | |
---|
| 58 | On error, this routine returns -1 and sets errno to one of the following: |
---|
| 59 | |
---|
| 60 | @table @b |
---|
| 61 | @item EINVAL |
---|
| 62 | The tp pointer parameter is invalid. |
---|
| 63 | |
---|
| 64 | @item EINVAL |
---|
| 65 | The clock_id specified is invalid. |
---|
| 66 | @end table |
---|
| 67 | |
---|
| 68 | @subheading DESCRIPTION: |
---|
| 69 | |
---|
| 70 | @subheading NOTES: |
---|
| 71 | |
---|
[d7fcc1d] | 72 | NONE |
---|
| 73 | |
---|
[6c914e9] | 74 | @page |
---|
[d7fcc1d] | 75 | @subsection clock_settime - |
---|
[6c914e9] | 76 | |
---|
| 77 | @subheading CALLING SEQUENCE: |
---|
| 78 | |
---|
| 79 | @example |
---|
| 80 | #include <time.h> |
---|
| 81 | |
---|
| 82 | int clock_settime( |
---|
| 83 | clockid_t clock_id, |
---|
| 84 | const struct timespec *tp |
---|
| 85 | ); |
---|
| 86 | @end example |
---|
| 87 | |
---|
| 88 | @subheading STATUS CODES: |
---|
| 89 | |
---|
| 90 | On error, this routine returns -1 and sets errno to one of the following: |
---|
| 91 | |
---|
| 92 | @table @b |
---|
| 93 | @item EINVAL |
---|
| 94 | The tp pointer parameter is invalid. |
---|
| 95 | |
---|
| 96 | @item EINVAL |
---|
| 97 | The clock_id specified is invalid. |
---|
| 98 | |
---|
| 99 | @item EINVAL |
---|
| 100 | The contents of the tp structure are invalid. |
---|
| 101 | |
---|
| 102 | @end table |
---|
| 103 | |
---|
| 104 | @subheading DESCRIPTION: |
---|
| 105 | |
---|
| 106 | @subheading NOTES: |
---|
[d7fcc1d] | 107 | |
---|
| 108 | NONE |
---|
[6c914e9] | 109 | |
---|
| 110 | @page |
---|
[d7fcc1d] | 111 | @subsection clock_getres - |
---|
[6c914e9] | 112 | |
---|
| 113 | @subheading CALLING SEQUENCE: |
---|
| 114 | |
---|
| 115 | @example |
---|
| 116 | #include <time.h> |
---|
| 117 | |
---|
| 118 | int clock_getres( |
---|
| 119 | clockid_t clock_id, |
---|
| 120 | struct timespec *res |
---|
| 121 | ); |
---|
| 122 | @end example |
---|
| 123 | |
---|
| 124 | @subheading STATUS CODES: |
---|
| 125 | |
---|
| 126 | On error, this routine returns -1 and sets errno to one of the following: |
---|
| 127 | |
---|
| 128 | @table @b |
---|
| 129 | @item EINVAL |
---|
| 130 | The res pointer parameter is invalid. |
---|
| 131 | |
---|
| 132 | @item EINVAL |
---|
| 133 | The clock_id specified is invalid. |
---|
| 134 | |
---|
| 135 | @end table |
---|
| 136 | |
---|
| 137 | @subheading DESCRIPTION: |
---|
| 138 | |
---|
| 139 | @subheading NOTES: |
---|
| 140 | |
---|
| 141 | If res is NULL, then the resolution is not returned. |
---|
| 142 | |
---|
| 143 | @page |
---|
[d7fcc1d] | 144 | @subsection sleep - Delay Process Execution |
---|
[6c914e9] | 145 | |
---|
| 146 | @subheading CALLING SEQUENCE: |
---|
| 147 | |
---|
| 148 | @example |
---|
| 149 | #include <time.h> |
---|
| 150 | |
---|
| 151 | unsigned int sleep( |
---|
| 152 | unsigned int seconds |
---|
| 153 | ); |
---|
| 154 | @end example |
---|
| 155 | |
---|
| 156 | @subheading STATUS CODES: |
---|
| 157 | |
---|
| 158 | This routine returns the number of unslept seconds. |
---|
| 159 | |
---|
| 160 | @subheading DESCRIPTION: |
---|
| 161 | |
---|
[d7fcc1d] | 162 | The @code{sleep()} function delays the calling thread by the specified |
---|
| 163 | number of @code{seconds}. |
---|
| 164 | |
---|
[6c914e9] | 165 | @subheading NOTES: |
---|
| 166 | |
---|
| 167 | This call is interruptible by a signal. |
---|
| 168 | |
---|
| 169 | @page |
---|
[d7fcc1d] | 170 | @subsection nanosleep - |
---|
[6c914e9] | 171 | |
---|
| 172 | @subheading CALLING SEQUENCE: |
---|
| 173 | |
---|
| 174 | @example |
---|
| 175 | #include <time.h> |
---|
| 176 | |
---|
| 177 | int nanosleep( |
---|
| 178 | const struct timespec *rqtp, |
---|
| 179 | struct timespec *rmtp |
---|
| 180 | ); |
---|
| 181 | @end example |
---|
| 182 | |
---|
| 183 | @subheading STATUS CODES: |
---|
| 184 | |
---|
| 185 | On error, this routine returns -1 and sets errno to one of the following: |
---|
| 186 | |
---|
| 187 | @table @b |
---|
| 188 | @item EINTR |
---|
| 189 | The routine was interrupted by a signal. |
---|
| 190 | |
---|
| 191 | @item EAGAIN |
---|
| 192 | The requested sleep period specified negative seconds or nanoseconds. |
---|
| 193 | |
---|
| 194 | @item EINVAL |
---|
| 195 | The requested sleep period specified an invalid number for the nanoseconds |
---|
| 196 | field. |
---|
| 197 | |
---|
| 198 | @end table |
---|
| 199 | |
---|
| 200 | @subheading DESCRIPTION: |
---|
| 201 | |
---|
| 202 | @subheading NOTES: |
---|
| 203 | |
---|
| 204 | This call is interruptible by a signal. |
---|
| 205 | |
---|
[c247120a] | 206 | @page |
---|
[f1ccfde] | 207 | @subsection gettimeofday - Get the Time of Day |
---|
[c247120a] | 208 | |
---|
| 209 | @subheading CALLING SEQUENCE: |
---|
| 210 | |
---|
| 211 | @example |
---|
| 212 | #include <sys/time.h> |
---|
| 213 | #include <unistd.h> |
---|
| 214 | |
---|
| 215 | int gettimeofday( |
---|
| 216 | struct timeval *tp, |
---|
| 217 | struct timezone *tzp |
---|
| 218 | ); |
---|
| 219 | @end example |
---|
| 220 | |
---|
| 221 | @subheading STATUS CODES: |
---|
| 222 | |
---|
[f1ccfde] | 223 | On error, this routine returns -1 and sets @code{errno} as appropriate. |
---|
| 224 | |
---|
| 225 | @table @b |
---|
| 226 | @item EPERM |
---|
| 227 | @code{settimeofdat} is called by someone other than the superuser. |
---|
| 228 | |
---|
| 229 | @item EINVAL |
---|
| 230 | Timezone (or something else) is invalid. |
---|
| 231 | |
---|
| 232 | @item EFAULT |
---|
| 233 | One of @code{tv} or @code{tz} pointed outside your accessible address |
---|
| 234 | space |
---|
| 235 | |
---|
| 236 | @end table |
---|
[c247120a] | 237 | |
---|
| 238 | @subheading DESCRIPTION: |
---|
| 239 | |
---|
[f1ccfde] | 240 | This routine returns the current time of day in the @code{tp} structure. |
---|
| 241 | |
---|
[c247120a] | 242 | @subheading NOTES: |
---|
| 243 | |
---|
[f1ccfde] | 244 | Currently, the timezone information is not supported. The @code{tzp} |
---|
| 245 | argument is ignored. |
---|
[c247120a] | 246 | |
---|
[6c914e9] | 247 | @page |
---|
[f1ccfde] | 248 | @subsection time - Get time in seconds |
---|
[6c914e9] | 249 | |
---|
| 250 | @subheading CALLING SEQUENCE: |
---|
| 251 | |
---|
| 252 | @example |
---|
| 253 | #include <time.h> |
---|
| 254 | |
---|
| 255 | int time( |
---|
| 256 | time_t *tloc |
---|
| 257 | ); |
---|
| 258 | @end example |
---|
| 259 | |
---|
| 260 | @subheading STATUS CODES: |
---|
| 261 | |
---|
| 262 | This routine returns the number of seconds since the Epoch. |
---|
| 263 | |
---|
| 264 | @subheading DESCRIPTION: |
---|
[f1ccfde] | 265 | |
---|
| 266 | @code{time} returns the time since 00:00:00 GMT, January 1, 1970, |
---|
| 267 | measured in seconds |
---|
| 268 | |
---|
| 269 | If @code{tloc} in non null, the return value is also stored in the |
---|
| 270 | memory pointed to by @code{t}. |
---|
| 271 | |
---|
| 272 | @subheading NOTES: |
---|
| 273 | |
---|
| 274 | NONE |
---|
| 275 | |
---|
| 276 | @page |
---|
| 277 | @subsection times - Get process times |
---|
| 278 | |
---|
| 279 | @subheading CALLING SEQUENCE: |
---|
| 280 | |
---|
| 281 | @example |
---|
| 282 | #include <sys/time.h> |
---|
| 283 | |
---|
| 284 | int time( |
---|
| 285 | clock_t times(struct tms *buf |
---|
| 286 | ); |
---|
| 287 | @end example |
---|
| 288 | |
---|
| 289 | @subheading STATUS CODES: |
---|
| 290 | |
---|
| 291 | This routine returns the process times |
---|
| 292 | |
---|
| 293 | @subheading DESCRIPTION: |
---|
| 294 | |
---|
| 295 | @code{times} stores the current process times in @code{buf}. |
---|
| 296 | |
---|
[c11f512] | 297 | @code{struct tms} is as defined in @code{/usr/include/sys/times.h} |
---|
[f1ccfde] | 298 | |
---|
| 299 | @code{times} returns the number of clock ticks that have elapsed |
---|
| 300 | since the systm has been up. |
---|
[6c914e9] | 301 | |
---|
| 302 | @subheading NOTES: |
---|
[d7fcc1d] | 303 | |
---|
| 304 | NONE |
---|
[6c914e9] | 305 | |
---|