- Wait for mouse acks properly.
[cake.git] / rom / timer / cmptime.c
blob58056aa37f05bc16e02dc2cb4d199d49f1c472d3
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: CmpTime() - compare two time values.
6 Lang: english
7 */
8 #include "timer_intern.h"
10 /*****************************************************************************
12 NAME */
13 #include <devices/timer.h>
14 #include <proto/timer.h>
16 AROS_LH2(LONG, CmpTime,
18 /* SYNOPSIS */
19 AROS_LHA(struct timeval *, dest, A0),
20 AROS_LHA(struct timeval *, src, A1),
22 /* LOCATION */
23 struct Device *, TimerBase, 9, Timer)
25 /* FUNCTION
26 CmpTime() will compare two timeval's for magnitude, and return
27 which is the larger.
29 INPUTS
30 dest - Destination timeval
31 src - Source timeval
33 RESULT
34 < 0 if dest has more time than src (ie dest > src)
35 = 0 if dest and src are the same (ie dest == src)
36 > 0 if dest has less time than src (ie dest < src)
38 NOTES
39 This function is safe to call from interrupts.
41 EXAMPLE
43 BUGS
44 The registers A0 and A1 may not be preserved.
46 SEE ALSO
47 AddTime(), SubTime()
49 INTERNALS
51 HISTORY
52 18-02-1997 iaint Implemented.
54 *****************************************************************************/
56 AROS_LIBFUNC_INIT
58 if(dest->tv_secs == src->tv_secs)
59 return (src->tv_micro - dest->tv_micro);
60 else
61 return (src->tv_secs - dest->tv_secs);
63 AROS_LIBFUNC_EXIT
64 } /* CmpTime */