summaryrefslogtreecommitdiff
path: root/kernel/src/arch/i686/drivers/rtc.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/src/arch/i686/drivers/rtc.c')
-rw-r--r--kernel/src/arch/i686/drivers/rtc.c13
1 files changed, 6 insertions, 7 deletions
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 <stdint.h>
-#include <sys.h>
+#include <arch.h>
#include <arch/i686/drivers/rtc.h>
#include <arch/i686/asm.h>
@@ -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;
}