Date functions (get current time)
This commit is contained in:
+14
-2
@@ -10,6 +10,7 @@
|
||||
#include <string/string.h>
|
||||
#include <stdint.h>
|
||||
#include <kernel.h>
|
||||
#include <time/date.h>
|
||||
|
||||
/*
|
||||
* pedicel_main - Kernel shell main function
|
||||
@@ -31,9 +32,13 @@ void pedicel_main(void* arg)
|
||||
keyboard_getline(input_buf, PEDICEL_INPUT_SIZE);
|
||||
|
||||
if (strncmp(input_buf, "help", 4) == 0) {
|
||||
printf("\r\npanic - trigger a test panic\r\n"
|
||||
printf("\r\nYou are currently running the test kernel shell. This is not\r\n"
|
||||
"a fully-fledged shell like you'd find in a complete operating system,\r\n"
|
||||
"but rather a toy to play around in the meantime.\r\n\r\n"
|
||||
"panic - trigger a test panic\r\n"
|
||||
"syscall - trigger int 0x80\r\n"
|
||||
"pf - trigger a page fault\r\n");
|
||||
"pf - trigger a page fault\r\n"
|
||||
"now - get current date\r\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -52,6 +57,13 @@ void pedicel_main(void* arg)
|
||||
fault[0] = 1;
|
||||
}
|
||||
|
||||
if (strncmp(input_buf, "now", 3) == 0) {
|
||||
struct date now = date_now();
|
||||
printf("Now is %02u:%02u:%02u on %u/%u/%u\r\n", now.hour, now.minute,
|
||||
now.second, now.day, now.month, now.year);
|
||||
continue;
|
||||
}
|
||||
|
||||
printf("%s: command not found\r\n", input_buf);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user