From da094d011f52a8f1ce879810cd1a4bbbe34f08d4 Mon Sep 17 00:00:00 2001 From: Tyler Murphy <=> Date: Sat, 22 Jul 2023 11:05:30 -0400 Subject: paging is not very fun --- kernel/src/arch/i686/drivers/rtc.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'kernel/src/arch/i686/drivers/rtc.c') diff --git a/kernel/src/arch/i686/drivers/rtc.c b/kernel/src/arch/i686/drivers/rtc.c index ba69d15..5f21f0a 100644 --- a/kernel/src/arch/i686/drivers/rtc.c +++ b/kernel/src/arch/i686/drivers/rtc.c @@ -1,6 +1,6 @@ #include "time.h" #include -#include +#include #include #include @@ -55,10 +55,9 @@ static void update_localtime(void) { localtime = time; // if tz is UTC, we dont need to do anythin - if (last_timezone == UTC) { - cur_localtime = localtime; - return; - } + if (last_timezone == UTC) return; + + localtime.hour += last_timezone; // check if day rolled over change = localtime.hour < 0 ? -1 : localtime.hour >= 24 ? 1 : 0; @@ -109,8 +108,6 @@ year: localtime.year -= 1900; - cur_localtime = localtime; - } void rtc_update(void) { @@ -137,6 +134,7 @@ void rtc_update(void) { update_localtime(); cur_time = time; + cur_localtime = localtime; } struct Time rtc_utctime(void) { @@ -147,6 +145,7 @@ struct Time rtc_localtime(enum Timezone tz) { if (tz != last_timezone) { last_timezone = tz; update_localtime(); + cur_localtime = localtime; } return cur_localtime; } -- cgit v1.2.3-freya