Style fixes

This commit is contained in:
Ali Mashtizadeh 2022-12-09 23:51:59 -05:00
parent f86e4ad966
commit dfff32378c

View File

@ -1,3 +1,7 @@
/*
* Copyright (c) 2006-2022 Ali Mashtizadeh
* All rights reserved.
*/
#include <stdbool.h>
#include <stdint.h>
@ -28,7 +32,7 @@ KTime_Init()
}
static bool
KTime_IsLeapYear(uint64_t year)
KTimeIsLeapYear(uint64_t year)
{
if ((year % 4) != 0)
return false;
@ -40,11 +44,11 @@ KTime_IsLeapYear(uint64_t year)
}
static int
KTime_DaysInMonth(uint64_t year, uint64_t month)
KTimeDaysInMonth(uint64_t year, uint64_t month)
{
static const uint64_t days[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
if ((month == 2) && KTime_IsLeapYear(year))
if ((month == 2) && KTimeIsLeapYear(year))
return 29;
else
return days[month];
@ -61,7 +65,7 @@ KTime_Fixup(KTime *tm)
if (tm->yday == -1) {
uint64_t yday = 0;
for (m = 0; m < tm->month; m++) {
yday += KTime_DaysInMonth(tm->year, m);
yday += KTimeDaysInMonth(tm->year, m);
}
yday += tm->mday;
tm->yday = yday;
@ -77,7 +81,7 @@ KTime_ToEpoch(const KTime *tm)
// Convert to UNIX epoch
for (y = 1970; y < tm->year; y++) {
if (KTime_IsLeapYear(y))
if (KTimeIsLeapYear(y))
days += 366;
else
days += 365;
@ -86,7 +90,7 @@ KTime_ToEpoch(const KTime *tm)
if (tm->yday == -1) {
uint64_t yday = 0;
for (m = 0; m < tm->month; m++) {
yday += KTime_DaysInMonth(tm->year, m);
yday += KTimeDaysInMonth(tm->year, m);
}
yday += tm->mday;
days += yday;
@ -129,7 +133,7 @@ KTime_FromEpoch(UnixEpoch epoch, KTime *tm)
for (y = 1970; ; y++) {
uint64_t daysOfYear;
if (KTime_IsLeapYear(y)) {
if (KTimeIsLeapYear(y)) {
daysOfYear = 366;
} else {
daysOfYear = 365;
@ -144,7 +148,7 @@ KTime_FromEpoch(UnixEpoch epoch, KTime *tm)
}
for (m = 0; ; m++) {
uint64_t daysOfMonth = KTime_DaysInMonth(tm->year, m);
uint64_t daysOfMonth = KTimeDaysInMonth(tm->year, m);
if (days < daysOfMonth) {
tm->mday = days;