From 927e4b60719f8f5ef5a85218316d1abeb38fced3 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Wed, 20 Sep 2023 19:04:50 -0300 Subject: [PATCH] Renamed time amounts --- include/siirtc.h | 6 +++--- src/pokemon.c | 2 +- src/rtc.c | 20 ++++++++++---------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/include/siirtc.h b/include/siirtc.h index 24573e4429..ad13fc62f3 100644 --- a/include/siirtc.h +++ b/include/siirtc.h @@ -9,9 +9,9 @@ #define SIIRTCINFO_24HOUR 0x40 // 0: 12-hour mode, 1: 24-hour mode #define SIIRTCINFO_POWER 0x80 // power on or power failure occurred -#define DAY_HOURS 24 -#define HOUR_MINUTES 60 -#define MINUTE_SECONDS 60 +#define HOURS_PER_DAY 24 +#define MINUTES_PER_HOUR 60 +#define SECONDS_PER_MINUTE 60 enum { diff --git a/src/pokemon.c b/src/pokemon.c index fe93c14c19..7eab3ccf68 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -49,7 +49,7 @@ #include "constants/union_room.h" #define DAY_EVO_HOUR_BEGIN 12 -#define DAY_EVO_HOUR_END DAY_HOURS +#define DAY_EVO_HOUR_END HOURS_PER_DAY #define NIGHT_EVO_HOUR_BEGIN 0 #define NIGHT_EVO_HOUR_END 12 diff --git a/src/rtc.c b/src/rtc.c index a4920025cf..b79f62a3c4 100644 --- a/src/rtc.c +++ b/src/rtc.c @@ -192,17 +192,17 @@ u16 RtcCheckInfo(struct SiiRtcInfo *rtc) value = ConvertBcdToBinary(rtc->hour); - if (value > DAY_HOURS) + if (value > HOURS_PER_DAY) errorFlags |= RTC_ERR_INVALID_HOUR; value = ConvertBcdToBinary(rtc->minute); - if (value > HOUR_MINUTES) + if (value > MINUTES_PER_HOUR) errorFlags |= RTC_ERR_INVALID_MINUTE; value = ConvertBcdToBinary(rtc->second); - if (value > MINUTE_SECONDS) + if (value > SECONDS_PER_MINUTE) errorFlags |= RTC_ERR_INVALID_SECOND; return errorFlags; @@ -270,19 +270,19 @@ void RtcCalcTimeDifference(struct SiiRtcInfo *rtc, struct Time *result, struct T if (result->seconds < 0) { - result->seconds += MINUTE_SECONDS; + result->seconds += SECONDS_PER_MINUTE; --result->minutes; } if (result->minutes < 0) { - result->minutes += HOUR_MINUTES; + result->minutes += MINUTES_PER_HOUR; --result->hours; } if (result->hours < 0) { - result->hours += DAY_HOURS; + result->hours += HOURS_PER_DAY; --result->days; } } @@ -317,19 +317,19 @@ void CalcTimeDifference(struct Time *result, struct Time *t1, struct Time *t2) if (result->seconds < 0) { - result->seconds += MINUTE_SECONDS; + result->seconds += SECONDS_PER_MINUTE; --result->minutes; } if (result->minutes < 0) { - result->minutes += HOUR_MINUTES; + result->minutes += MINUTES_PER_HOUR; --result->hours; } if (result->hours < 0) { - result->hours += DAY_HOURS; + result->hours += HOURS_PER_DAY; --result->days; } } @@ -337,7 +337,7 @@ void CalcTimeDifference(struct Time *result, struct Time *t1, struct Time *t2) u32 RtcGetMinuteCount(void) { RtcGetInfo(&sRtc); - return (DAY_HOURS * HOUR_MINUTES) * RtcGetDayCount(&sRtc) + HOUR_MINUTES * sRtc.hour + sRtc.minute; + return (HOURS_PER_DAY * MINUTES_PER_HOUR) * RtcGetDayCount(&sRtc) + MINUTES_PER_HOUR * sRtc.hour + sRtc.minute; } u32 RtcGetLocalDayCount(void)