Fix: 64-bit compatibility
[AROS.git] / compiler / stdc / clock.c
blob2784bb07758a3ab453be1126f3a842e81b5b1a0e
1 /*
2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
3 $Id$
5 Returns time passed since start of program.
6 */
8 #include <aros/symbolsets.h>
10 #include "__stdc_intbase.h"
12 /*****************************************************************************
14 NAME */
15 #include <time.h>
17 clock_t clock (
19 /* SYNOPSIS */
20 void)
22 /* FUNCTION
23 clock() returns an approximation of the time passed since
24 the program was started
26 INPUTS
28 RESULT
29 The time passed in CLOCKS_PER_SEC units. To get the
30 number of seconds divide by CLOCKS_PER_SEC.
32 NOTES
33 Reference point is set when stdc.library is opened.
34 If you use the function from another shared library the reference
35 point is thus when this library opened stdc.library
37 EXAMPLE
39 BUGS
41 SEE ALSO
42 time()
44 INTERNALS
46 ******************************************************************************/
48 struct StdCIntBase *StdCBase = (struct StdCIntBase *)__aros_getbase_StdCBase();
50 return (clock_t)time(NULL) - StdCBase->starttime;
51 } /* clock */
53 int __init_clock(struct StdCIntBase *StdCBase)
55 StdCBase->starttime = (clock_t)time(NULL);
57 return 1;
60 ADD2OPENLIB(__init_clock, 20);