diff options
author | Your Name <you@example.com> | 2020-06-23 19:39:48 +0200 |
---|---|---|
committer | Your Name <you@example.com> | 2020-06-23 19:39:48 +0200 |
commit | a2687d54dfb1eae7809a55930254acc5869eb0d5 (patch) | |
tree | e2779ea34953866708a5c19485b99d19d02ce06f | |
parent | Base: Added support for interrupts and exception handlers (diff) | |
download | pOS-a2687d54dfb1eae7809a55930254acc5869eb0d5.tar.gz pOS-a2687d54dfb1eae7809a55930254acc5869eb0d5.tar.bz2 pOS-a2687d54dfb1eae7809a55930254acc5869eb0d5.zip |
Format: Added the option to get the hour in the 12h format (instead of
24)
-rw-r--r-- | src/pOS/arch/x86/kernel/rtc.cpp | 5 | ||||
-rw-r--r-- | src/pOS/arch/x86/kernel/time.cpp | 2 | ||||
-rw-r--r-- | src/pOS/include/kernel/pOS.h | 2 | ||||
-rw-r--r-- | src/pOS/include/kernel/rtc.h | 1 |
4 files changed, 9 insertions, 1 deletions
diff --git a/src/pOS/arch/x86/kernel/rtc.cpp b/src/pOS/arch/x86/kernel/rtc.cpp index ab64a90..cf531df 100644 --- a/src/pOS/arch/x86/kernel/rtc.cpp +++ b/src/pOS/arch/x86/kernel/rtc.cpp @@ -18,6 +18,11 @@ uint8_t RTC::read_cmos(uint8_t registr) if(!(System::inb(CMOS_DATA) & 0x04)) //to binary result = (result & 0x0F) + ((result/ 16) * 10); + #ifdef TIME_FORMAT_12H + if(registr == CMOS_READ_HOUR) + result = ((result & 0x7F) + 12) % 24; + #endif + return result; } diff --git a/src/pOS/arch/x86/kernel/time.cpp b/src/pOS/arch/x86/kernel/time.cpp index b0e50b9..a231940 100644 --- a/src/pOS/arch/x86/kernel/time.cpp +++ b/src/pOS/arch/x86/kernel/time.cpp @@ -40,7 +40,7 @@ uint8_t Time::get_minute(void) return Time::get_date().minute; } -uint8_t Time::get_hour(void) +uint8_t Time::get_hour(void) //define so it can be 24h { return Time::get_date().hour; } diff --git a/src/pOS/include/kernel/pOS.h b/src/pOS/include/kernel/pOS.h index 176a3c1..f26b739 100644 --- a/src/pOS/include/kernel/pOS.h +++ b/src/pOS/include/kernel/pOS.h @@ -15,6 +15,8 @@ #define DEBUG #define VERSION "meme" +//#define TIME_FORMAT_12H + #define DRIVER_EXAMPLE #endif diff --git a/src/pOS/include/kernel/rtc.h b/src/pOS/include/kernel/rtc.h index c0aa71d..0411bd8 100644 --- a/src/pOS/include/kernel/rtc.h +++ b/src/pOS/include/kernel/rtc.h @@ -4,6 +4,7 @@ #include <stdint.h> #include <kernel/time.h> #include <kernel/system.h> +#include <kernel/pOS.h> #define CMOS_PORT 0x70 #define CMOS_DATA 0x71 |