Mercurial > ecos
comparison packages/compat/posix/current/include/time.h @ 115:6ed91473a1cd ecos-sw-2000-08-21
Merge from eCos master repository on 2000-08-21-22:40:54-BST
| author | jlarmour |
|---|---|
| date | Fri, 25 Aug 2000 17:32:38 +0000 |
| parents | |
| children | 678094f34118 |
comparison
equal
deleted
inserted
replaced
| 114:5ad2b71d525e | 115:6ed91473a1cd |
|---|---|
| 1 #ifndef CYGONCE_POSIX_TIME_H | |
| 2 #define CYGONCE_POSIX_TIME_H | |
| 3 //============================================================================= | |
| 4 // | |
| 5 // time.h | |
| 6 // | |
| 7 // POSIX time header | |
| 8 // | |
| 9 //============================================================================= | |
| 10 //####COPYRIGHTBEGIN#### | |
| 11 // | |
| 12 // ------------------------------------------- | |
| 13 // The contents of this file are subject to the Red Hat eCos Public License | |
| 14 // Version 1.1 (the "License"); you may not use this file except in | |
| 15 // compliance with the License. You may obtain a copy of the License at | |
| 16 // http://www.redhat.com/ | |
| 17 // | |
| 18 // Software distributed under the License is distributed on an "AS IS" | |
| 19 // basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the | |
| 20 // License for the specific language governing rights and limitations under | |
| 21 // the License. | |
| 22 // | |
| 23 // The Original Code is eCos - Embedded Configurable Operating System, | |
| 24 // released September 30, 1998. | |
| 25 // | |
| 26 // The Initial Developer of the Original Code is Red Hat. | |
| 27 // Portions created by Red Hat are | |
| 28 // Copyright (C) 1998, 1999, 2000 Red Hat, Inc. | |
| 29 // All Rights Reserved. | |
| 30 // ------------------------------------------- | |
| 31 // | |
| 32 //####COPYRIGHTEND#### | |
| 33 //============================================================================= | |
| 34 //#####DESCRIPTIONBEGIN#### | |
| 35 // | |
| 36 // Author(s): nickg | |
| 37 // Contributors: nickg, jlarmour | |
| 38 // Date: 2000-03-17 | |
| 39 // Purpose: POSIX time header | |
| 40 // Description: This header contains all the definitions needed to support | |
| 41 // the POSIX timer and timer API under eCos. | |
| 42 // | |
| 43 // Usage: Do not include this file directly - instead include <time.h> | |
| 44 // | |
| 45 // | |
| 46 //####DESCRIPTIONEND#### | |
| 47 // | |
| 48 //============================================================================= | |
| 49 | |
| 50 #include <cyg/infra/cyg_type.h> | |
| 51 | |
| 52 //----------------------------------------------------------------------------- | |
| 53 // Types for timers and clocks | |
| 54 | |
| 55 typedef int clockid_t; | |
| 56 | |
| 57 typedef int timer_t; | |
| 58 | |
| 59 // forward declaration - if the app uses it it will have to include | |
| 60 // signal.h anyway | |
| 61 struct sigevent; | |
| 62 | |
| 63 //----------------------------------------------------------------------------- | |
| 64 // Structures | |
| 65 | |
| 66 struct timespec | |
| 67 { | |
| 68 time_t tv_sec; | |
| 69 long tv_nsec; | |
| 70 }; | |
| 71 | |
| 72 struct itimerspec | |
| 73 { | |
| 74 struct timespec it_interval; | |
| 75 struct timespec it_value; | |
| 76 }; | |
| 77 | |
| 78 //----------------------------------------------------------------------------- | |
| 79 // Manifest constants | |
| 80 | |
| 81 #define CLOCK_REALTIME 0 | |
| 82 | |
| 83 #define TIMER_ABSTIME 1 | |
| 84 | |
| 85 //----------------------------------------------------------------------------- | |
| 86 // Clock functions | |
| 87 | |
| 88 // Set the clocks current time | |
| 89 externC int clock_settime( clockid_t clock_id, const struct timespec *tp); | |
| 90 | |
| 91 // Get the clocks current time | |
| 92 externC int clock_gettime( clockid_t clock_id, struct timespec *tp); | |
| 93 | |
| 94 // Get the clocks resolution | |
| 95 externC int clock_getres( clockid_t clock_id, struct timespec *tp); | |
| 96 | |
| 97 | |
| 98 //----------------------------------------------------------------------------- | |
| 99 // Timer functions | |
| 100 | |
| 101 // Create a timer based on the given clock. | |
| 102 externC int timer_create( clockid_t clock_id, | |
| 103 struct sigevent *evp, | |
| 104 timer_t *timer_id); | |
| 105 | |
| 106 // Delete the timer | |
| 107 externC int timer_delete( timer_t timer_id ); | |
| 108 | |
| 109 // Set the expiration time of the timer. | |
| 110 externC int timer_settime( timer_t timerid, int flags, | |
| 111 const struct itimerspec *value, | |
| 112 struct itimerspec *ovalue ); | |
| 113 | |
| 114 // Get current timer values | |
| 115 externC int timer_gettime( timer_t timerid, struct itimerspec *value ); | |
| 116 | |
| 117 // Get number of missed triggers | |
| 118 externC int timer_getoverrun( timer_t timerid ); | |
| 119 | |
| 120 //----------------------------------------------------------------------------- | |
| 121 // Nanosleep | |
| 122 | |
| 123 // Sleep for the given time. | |
| 124 externC int nanosleep( const struct timespec *rqtp, | |
| 125 struct timespec *rmtp); | |
| 126 | |
| 127 | |
| 128 //----------------------------------------------------------------------------- | |
| 129 #endif // ifndef CYGONCE_POSIX_TIME_H | |
| 130 // End of time.h |
