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