gbdk-2020 | GameBoy Development Kit |
| download: https://git.y1.nz/archives/gbdk.tar.gz | |
| README | Files | Log | Refs | LICENSE |
gbdk-lib/include/time.h
1 /** @file time.h
2 Sort of ANSI compliant time functions.
3 */
4 #ifndef TIME_INCLUDE
5 #define TIME_INCLUDE
6
7 #include <types.h>
8 #include <stdint.h>
9
10 #define CLOCKS_PER_SEC 60
11
12 typedef uint16_t time_t;
13
14 /** Returns an approximation of processor time used by the program in Clocks
15
16 The value returned is the CPU time (ticks) used so far as a @ref clock_t.
17
18 To get the number of seconds used, divide by @ref CLOCKS_PER_SEC.
19
20 This is based on @ref sys_time, which will wrap around every ~18 minutes.
21 (unsigned 16 bits = 65535 / 60 / 60 = 18.2)
22
23 @see sys_time, time()
24 */
25 clock_t clock(void) OLDCALL;
26
27 /** Converts clock() time to Seconds
28
29 @param t If pointer __t__ is not NULL, it's value will be set to the same seconds calculation as returned by the function.
30
31 The calculation is clock() / CLOCKS_PER_SEC
32
33 Returns: time in seconds
34 @see sys_time, clock()
35 */
36 time_t time(time_t *t);
37
38 #endif
This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.