Twilight Princess
Decompilation of The Legend of Zelda: Twilight Princess
Loading...
Searching...
No Matches
OSTime.h
Go to the documentation of this file.
1#ifndef OSTIME_H
2#define OSTIME_H
3
4#include "dolphin/types.h"
5
6#ifdef __cplusplus
7extern "C" {
8#endif
9
10typedef s64 OSTime;
11typedef u32 OSTick;
12
14
15typedef struct OSCalendarTime {
16 /* 0x00 */ s32 seconds;
17 /* 0x04 */ s32 minutes;
18 /* 0x08 */ s32 hours;
19 /* 0x0C */ s32 day_of_month;
20 /* 0x10 */ s32 month;
21 /* 0x14 */ s32 year;
22 /* 0x18 */ s32 week_day;
23 /* 0x1C */ s32 year_day;
24 /* 0x20 */ s32 milliseconds;
25 /* 0x24 */ s32 microseconds;
27
28OSTime OSGetTime(void);
29OSTick OSGetTick(void);
34
35extern u32 __OSBusClock AT_ADDRESS(0x800000F8);
36
37#define OS_BUS_CLOCK (__OSBusClock)
38#define OS_CORE_CLOCK (*(u32*)0x800000FC)
39#define OS_TIMER_CLOCK (OS_BUS_CLOCK / 4)
40#define OS_TIMER_CLOCK_MS (OS_TIMER_CLOCK / 1000)
41
42#define OSTicksToCycles(ticks) (((ticks) * ((OS_CORE_CLOCK * 2) / OS_TIMER_CLOCK)) / 2)
43#define OSTicksToSeconds(ticks) ((ticks) / OS_TIMER_CLOCK)
44#define OSTicksToMilliseconds(ticks) ((ticks) / (OS_TIMER_CLOCK / 1000))
45#define OSTicksToMicroseconds(ticks) (((ticks)*8) / (OS_TIMER_CLOCK / 125000))
46#define OSTicksToNanoseconds(ticks) (((ticks)*8000) / (OS_TIMER_CLOCK / 125000))
47#define OSSecondsToTicks(sec) ((sec)*OS_TIMER_CLOCK)
48#define OSMillisecondsToTicks(msec) ((msec) * (OS_TIMER_CLOCK / 1000))
49#define OSMicrosecondsToTicks(usec) (((usec) * (OS_TIMER_CLOCK / 125000)) / 8)
50#define OSNanosecondsToTicks(nsec) (((nsec) * (OS_TIMER_CLOCK / 125000)) / 8000)
51
52#ifdef __cplusplus
53};
54#endif
55
56#endif /* OSTIME_H */
OSTime time
Definition GXInit.c:61
OSTime OSGetTime(void)
Definition OSTime.c:9
OSTime OS_SYSTEM_TIME AT_ADDRESS(0x800030D8)
s64 OSTime
Definition OSTime.h:10
void GetDates(s32 days, OSCalendarTime *ct)
void OSTicksToCalendarTime(OSTime ticks, OSCalendarTime *ct)
Definition OSTime.c:120
u32 OSTick
Definition OSTime.h:11
OSTime __OSTimeToSystemTime(OSTime time)
Definition OSTime.c:50
OSTick OSGetTick(void)
Definition OSTime.c:25
OSTime __OSGetSystemTime(void)
Definition OSTime.c:37
T cLib_calcTimer(T *value)
Definition c_lib.h:74
Definition OSTime.h:15
s32 week_day
Definition OSTime.h:22
s32 year
Definition OSTime.h:21
s32 microseconds
Definition OSTime.h:25
s32 month
Definition OSTime.h:20
s32 minutes
Definition OSTime.h:17
s32 year_day
Definition OSTime.h:23
s32 hours
Definition OSTime.h:18
s32 day_of_month
Definition OSTime.h:19
s32 milliseconds
Definition OSTime.h:24
s32 seconds
Definition OSTime.h:16
unsigned long u32
Definition types.h:10
signed long long s64
Definition types.h:7
signed long s32
Definition types.h:6