From dfff32378c2d5e863d9db39e4e651abf783f49e1 Mon Sep 17 00:00:00 2001 From: Ali Mashtizadeh Date: Fri, 9 Dec 2022 23:51:59 -0500 Subject: [PATCH] Style fixes --- sys/kern/ktime.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/sys/kern/ktime.c b/sys/kern/ktime.c index 7da08ca..2c131a3 100644 --- a/sys/kern/ktime.c +++ b/sys/kern/ktime.c @@ -1,3 +1,7 @@ +/* + * Copyright (c) 2006-2022 Ali Mashtizadeh + * All rights reserved. + */ #include #include @@ -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;