diff options
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); } |