Renamed time amounts

This commit is contained in:
Eduardo Quezada 2023-09-20 19:04:50 -03:00
parent fb6f45b2c3
commit 927e4b6071
3 changed files with 14 additions and 14 deletions

View file

@ -9,9 +9,9 @@
#define SIIRTCINFO_24HOUR 0x40 // 0: 12-hour mode, 1: 24-hour mode #define SIIRTCINFO_24HOUR 0x40 // 0: 12-hour mode, 1: 24-hour mode
#define SIIRTCINFO_POWER 0x80 // power on or power failure occurred #define SIIRTCINFO_POWER 0x80 // power on or power failure occurred
#define DAY_HOURS 24 #define HOURS_PER_DAY 24
#define HOUR_MINUTES 60 #define MINUTES_PER_HOUR 60
#define MINUTE_SECONDS 60 #define SECONDS_PER_MINUTE 60
enum enum
{ {

View file

@ -49,7 +49,7 @@
#include "constants/union_room.h" #include "constants/union_room.h"
#define DAY_EVO_HOUR_BEGIN 12 #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_BEGIN 0
#define NIGHT_EVO_HOUR_END 12 #define NIGHT_EVO_HOUR_END 12

View file

@ -192,17 +192,17 @@ u16 RtcCheckInfo(struct SiiRtcInfo *rtc)
value = ConvertBcdToBinary(rtc->hour); value = ConvertBcdToBinary(rtc->hour);
if (value > DAY_HOURS) if (value > HOURS_PER_DAY)
errorFlags |= RTC_ERR_INVALID_HOUR; errorFlags |= RTC_ERR_INVALID_HOUR;
value = ConvertBcdToBinary(rtc->minute); value = ConvertBcdToBinary(rtc->minute);
if (value > HOUR_MINUTES) if (value > MINUTES_PER_HOUR)
errorFlags |= RTC_ERR_INVALID_MINUTE; errorFlags |= RTC_ERR_INVALID_MINUTE;
value = ConvertBcdToBinary(rtc->second); value = ConvertBcdToBinary(rtc->second);
if (value > MINUTE_SECONDS) if (value > SECONDS_PER_MINUTE)
errorFlags |= RTC_ERR_INVALID_SECOND; errorFlags |= RTC_ERR_INVALID_SECOND;
return errorFlags; return errorFlags;
@ -270,19 +270,19 @@ void RtcCalcTimeDifference(struct SiiRtcInfo *rtc, struct Time *result, struct T
if (result->seconds < 0) if (result->seconds < 0)
{ {
result->seconds += MINUTE_SECONDS; result->seconds += SECONDS_PER_MINUTE;
--result->minutes; --result->minutes;
} }
if (result->minutes < 0) if (result->minutes < 0)
{ {
result->minutes += HOUR_MINUTES; result->minutes += MINUTES_PER_HOUR;
--result->hours; --result->hours;
} }
if (result->hours < 0) if (result->hours < 0)
{ {
result->hours += DAY_HOURS; result->hours += HOURS_PER_DAY;
--result->days; --result->days;
} }
} }
@ -317,19 +317,19 @@ void CalcTimeDifference(struct Time *result, struct Time *t1, struct Time *t2)
if (result->seconds < 0) if (result->seconds < 0)
{ {
result->seconds += MINUTE_SECONDS; result->seconds += SECONDS_PER_MINUTE;
--result->minutes; --result->minutes;
} }
if (result->minutes < 0) if (result->minutes < 0)
{ {
result->minutes += HOUR_MINUTES; result->minutes += MINUTES_PER_HOUR;
--result->hours; --result->hours;
} }
if (result->hours < 0) if (result->hours < 0)
{ {
result->hours += DAY_HOURS; result->hours += HOURS_PER_DAY;
--result->days; --result->days;
} }
} }
@ -337,7 +337,7 @@ void CalcTimeDifference(struct Time *result, struct Time *t1, struct Time *t2)
u32 RtcGetMinuteCount(void) u32 RtcGetMinuteCount(void)
{ {
RtcGetInfo(&sRtc); 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) u32 RtcGetLocalDayCount(void)