diff options
author | Tyler Murphy <=> | 2023-07-16 19:56:56 -0400 |
---|---|---|
committer | Tyler Murphy <=> | 2023-07-16 19:56:56 -0400 |
commit | 8ad6ef551e9a1c51a77f3662978c7559556897d6 (patch) | |
tree | ed07aeae3122a009385d7db8fc98a61b25c38c99 /kernel/src/interrupt | |
parent | initial (diff) | |
download | finix-8ad6ef551e9a1c51a77f3662978c7559556897d6.tar.gz finix-8ad6ef551e9a1c51a77f3662978c7559556897d6.tar.bz2 finix-8ad6ef551e9a1c51a77f3662978c7559556897d6.zip |
time
Diffstat (limited to 'kernel/src/interrupt')
-rw-r--r-- | kernel/src/interrupt/idt.asm (renamed from kernel/src/interrupt/isr.asm) | 0 | ||||
-rw-r--r-- | kernel/src/interrupt/idt.c | 24 |
2 files changed, 17 insertions, 7 deletions
diff --git a/kernel/src/interrupt/isr.asm b/kernel/src/interrupt/idt.asm index 6cccdc6..6cccdc6 100644 --- a/kernel/src/interrupt/isr.asm +++ b/kernel/src/interrupt/idt.asm diff --git a/kernel/src/interrupt/idt.c b/kernel/src/interrupt/idt.c index 6df3793..aaa7034 100644 --- a/kernel/src/interrupt/idt.c +++ b/kernel/src/interrupt/idt.c @@ -9,25 +9,35 @@ #include "acpi/acpi.h" #include "drivers/ps2kb.h" #include "drivers/ps2mouse.h" +#include "time.h" #include "tty/color.h" #include "idt.h" #include "pic.h" #include "tty/term.h" -static int timer = 0; +#define WIDTH 30 +static char buf[WIDTH]; +static int timer = -1; void idt_pic_eoi(uint8_t exception) { pic_eoi(exception - PIC_REMAP_OFFSET); } void idt_pic_timer(void) { - uint32_t state = term_save(); - term_setfg(VGA_LIGHT_GREEN); - term_setpos(60, 0); - puts(" "); - term_setpos(60, 0); - printk("%d", timer); + timer += 1; + if (timer % 20 != 0) return; + + uint32_t state = term_save(); + + term_setfg(VGA_LIGHT_GREEN); + term_setpos(TERM_W - WIDTH - 1, 0); + for (size_t i = 0; i < WIDTH; i++) putchar(' '); + term_setpos(TERM_W - WIDTH - 1, 0); + + timetostr(rtc_localtime(), "%a %b %d %Y %H:%M:%S", buf, WIDTH); + printk("%s", buf); + term_load(state); } |