*** empty log message ***
[arla.git] / lwp / timer.h
blobef4cff5889520da852b63a3aab8edd5b35f50b1e
1 /*
2 ****************************************************************************
3 * Copyright IBM Corporation 1988, 1989 - All Rights Reserved *
4 * *
5 * Permission to use, copy, modify, and distribute this software and its *
6 * documentation for any purpose and without fee is hereby granted, *
7 * provided that the above copyright notice appear in all copies and *
8 * that both that copyright notice and this permission notice appear in *
9 * supporting documentation, and that the name of IBM not be used in *
10 * advertising or publicity pertaining to distribution of the software *
11 * without specific, written prior permission. *
12 * *
13 * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL *
14 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL IBM *
15 * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY *
16 * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER *
17 * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING *
18 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. *
19 ****************************************************************************
22 /*******************************************************************\
23 * *
24 * Information Technology Center *
25 * Carnegie-Mellon University *
26 * *
27 * *
28 \*******************************************************************/
30 struct TM_Elem {
31 struct TM_Elem *Next; /* filled by package */
32 struct TM_Elem *Prev; /* filled by package */
33 struct timeval TotalTime; /* filled in by caller -- modified by package */
34 struct timeval TimeLeft; /* filled by package */
35 char *BackPointer; /* filled by caller, not interpreted by package */
38 #ifndef _TIMER_IMPL_
39 extern void Tm_Insert();
40 #define TM_Remove(list, elem) lwp_remque(elem)
41 extern int TM_Rescan();
42 extern struct TM_Elem *TM_GetExpired();
43 extern struct TM_Elem *TM_GetEarliest();
44 #endif
46 int TM_Init(struct TM_Elem **list);
47 int TM_Rescan(struct TM_Elem *tlist);
48 struct TM_Elem *TM_GetExpired(struct TM_Elem *tlist);
49 struct TM_Elem *TM_GetEarliest(struct TM_Elem *tlist);
51 typedef unsigned char bool; /* XXX - this is not the correct place */
53 bool TM_eql(struct timeval *, struct timeval *);
54 int TM_Final(struct TM_Elem **);
55 void TM_Insert(struct TM_Elem *, struct TM_Elem *);
57 #define FOR_ALL_ELTS(var, list, body)\
59 struct TM_Elem *_LIST_, *var, *_NEXT_;\
60 _LIST_ = (list);\
61 for (var = _LIST_ -> Next; var != _LIST_; var = _NEXT_) {\
62 _NEXT_ = var -> Next;\
63 body\
67 /* ---------------------- */
70 * FT - prototypes.
71 * This is completly wrong place to place this.
72 * But fasttime doesn't have any own prototypes.
73 * (fasttime should be shot anyway)
76 int FT_Init(int, int);
77 int FT_GetTimeOfDay(struct timeval * tv, struct timezone * tz);
78 int FT_AGetTimeOfDay(struct timeval *, struct timezone *);
79 int TM_GetTimeOfDay(struct timeval * tv, struct timezone * tz);
80 unsigned int FT_ApproxTime(void);