1 /*---------------------------------------------------------------------------* 2 Project: TwlSDK - RTC - include 3 File: convert.h 4 5 Copyright 2003-2008 Nintendo. All rights reserved. 6 7 These coded instructions, statements, and computer programs contain 8 proprietary information of Nintendo of America Inc. and/or Nintendo 9 Company Ltd., and are protected by Federal copyright law. They may 10 not be disclosed to third parties or copied or duplicated in any form, 11 in whole or in part, without the prior written consent of Nintendo. 12 13 $Date:: $ 14 $Rev:$ 15 $Author:$ 16 *---------------------------------------------------------------------------*/ 17 18 #ifndef NITRO_RTC_ARM9_CONVERT_H_ 19 #define NITRO_RTC_ARM9_CONVERT_H_ 20 21 #ifdef __cplusplus 22 extern "C" { 23 #endif 24 25 /*===========================================================================*/ 26 27 #include <nitro/types.h> 28 29 /*---------------------------------------------------------------------------* 30 Constant Definitions 31 *---------------------------------------------------------------------------*/ 32 33 34 /*---------------------------------------------------------------------------* 35 Structure Definitions 36 *---------------------------------------------------------------------------*/ 37 38 39 /*---------------------------------------------------------------------------* 40 Function Declarations 41 *---------------------------------------------------------------------------*/ 42 43 /*---------------------------------------------------------------------------* 44 Name: RTC_ConvertDateToDay 45 46 Description: Converts date data from RTCDate type to the total number of days since the year 2000. 47 48 Arguments: date - Pointer to date data. 49 50 Returns: The total number of days since Jan. 1, 2000. 51 *---------------------------------------------------------------------------*/ 52 s32 RTC_ConvertDateToDay(const RTCDate *date); 53 54 /*---------------------------------------------------------------------------* 55 Name: RTCi_ConvertTimeToSecond 56 57 Description: Converts time data in RTCTime type to the total number of seconds since 0:00. 58 59 Arguments: time - Pointer to the time data. 60 61 Returns: Total number of seconds since 0:00. 62 *---------------------------------------------------------------------------*/ 63 s32 RTCi_ConvertTimeToSecond(const RTCTime *time); 64 65 /*---------------------------------------------------------------------------* 66 Name: RTC_ConvertDateTimeToSecond 67 68 Description: Converts date and time data in RTCDate and RTCTime types to total number of seconds. 69 70 Arguments: date - Pointer to date data. 71 time - Pointer to the time data. 72 73 Returns: Total number of seconds since 0:00, Jan. 1, 2000, local time. 74 *---------------------------------------------------------------------------*/ 75 s64 RTC_ConvertDateTimeToSecond(const RTCDate *date, const RTCTime *time); 76 77 /*---------------------------------------------------------------------------* 78 Name: RTC_ConvertDayToDate 79 80 Description: Converts the total number of days since the year 2000 to date data in RTCDate type. 81 82 Arguments: date - Pointer to save destination date data. 83 day - The total number of days since Jan 1, 2000. 84 85 Returns: None. 86 *---------------------------------------------------------------------------*/ 87 void RTC_ConvertDayToDate(RTCDate *date, s32 day); 88 89 /*---------------------------------------------------------------------------* 90 Name: RTCi_ConvertSecondToTime 91 92 Description: Converts the total number of seconds since 0:00 to time data in RTCTime type. 93 94 Arguments: time - Pointer to save destination date data. 95 sec -Total number of seconds since 0:00. 96 97 Returns: None. 98 *---------------------------------------------------------------------------*/ 99 void RTCi_ConvertSecondToTime(RTCTime *time, s32 sec); 100 101 /*---------------------------------------------------------------------------* 102 Name: RTC_ConvertDateTimeToSecond 103 104 Description: Converts total number of seconds to date and time data in RTCDate and RTCTime types. 105 106 Arguments: date - Pointer to save destination date data. 107 time - Pointer to the save destination time data. 108 sec - Total number of seconds since 0:00 Jan 1, 2000. 109 110 Returns: None. 111 *---------------------------------------------------------------------------*/ 112 void RTC_ConvertSecondToDateTime(RTCDate *date, RTCTime *time, s64 sec); 113 114 /*---------------------------------------------------------------------------* 115 Name: RTC_GetDayOfWeek 116 117 Description: Returns the day of the week based on RTCDate type data. 118 (This is found based on a calculation rather than using the day of the week inside RTCDate.) 119 120 Arguments: date - Pointer to date data. 121 122 Returns: Day of week RTC_WEEK_xxxx 123 *---------------------------------------------------------------------------*/ 124 RTCWeek RTC_GetDayOfWeek(RTCDate *date); 125 126 /*===========================================================================*/ 127 128 #ifdef __cplusplus 129 } /* extern "C" */ 130 #endif 131 132 #endif /* NITRO_RTC_ARM9_CONVERT_H_ */ 133 134 /*---------------------------------------------------------------------------* 135 End of file 136 *---------------------------------------------------------------------------*/ 137