Twilight Princess
Decompilation of The Legend of Zelda: Twilight Princess
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
OSTime.h
Go to the documentation of this file.
1#ifndef _DOLPHIN_OSTIME_H_
2#define _DOLPHIN_OSTIME_H_
3
4#include <dolphin/types.h>
5
6#ifdef __cplusplus
7extern "C" {
8#endif
9
10// Time base frequency = 1/4 bus clock
11#define OS_TIME_SPEED (OS_BUS_CLOCK / 4)
12
13// OS time -> Real time
14#define OS_TICKS_TO_SEC(x) ((x) / (OS_TIME_SPEED))
15#define OS_TICKS_TO_MSEC(x) ((x) / (OS_TIME_SPEED / 1000))
16#define OS_TICKS_TO_USEC(x) (((x)*8) / (OS_TIME_SPEED / 125000))
17#define OS_TICKS_TO_NSEC(x) (((x)*8000) / (OS_TIME_SPEED / 125000))
18
19// Real time -> OS time
20#define OS_SEC_TO_TICKS(x) ((x) * (OS_TIME_SPEED))
21#define OS_MSEC_TO_TICKS(x) ((x) * (OS_TIME_SPEED / 1000))
22#define OS_USEC_TO_TICKS(x) ((x) * (OS_TIME_SPEED / 125000) / 8)
23#define OS_NSEC_TO_TICKS(x) ((x) * (OS_TIME_SPEED / 125000) / 8000)
24
25#define USEC_MAX 1000
26#define MSEC_MAX 1000
27#define MONTH_MAX 12
28#define WEEK_DAY_MAX 7
29#define YEAR_DAY_MAX 365
30
31#define SECS_IN_MIN 60
32#define SECS_IN_HOUR (SECS_IN_MIN * 60)
33#define SECS_IN_DAY (SECS_IN_HOUR * 24)
34#define SECS_IN_YEAR (SECS_IN_DAY * 365)
35
36#define BIAS 0xB2575
37
38#define __OSSystemTime (OSTime*)0x800030D8
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif // _DOLPHIN_OSTIME_H_