Skip to content

Commit

Permalink
Updated time module
Browse files Browse the repository at this point in the history
Signed-off-by: Riyan Dhiman <[email protected]>
  • Loading branch information
Ryand1234 committed Jul 26, 2024
1 parent 6c2829a commit 8361e96
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions kernel/arch/i386/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,9 @@ struct kernel_time rtc_time() {
struct kernel_time time = read_rtc_hardware_time();
convert_bcd_to_binary(&time);
return time;
}

void show_time() {
struct kernel_time time = rtc_time();
printf("current time: %d:%d:%d %d:%d:%d%d\n", time.hour, time.minute, time.second, time.day, time.month, time.century, time.year);
}
1 change: 1 addition & 0 deletions kernel/include/arch/i386/time.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@ struct kernel_time convert_timestamp_to_datetime(uint32_t);
uint32_t convert_datetime_to_timestamp(struct kernel_time);
void get_system_time(struct kernel_time *);
int set_systme_time(struct kernel_time *);
void show_time(void);

#endif
3 changes: 1 addition & 2 deletions kernel/kernel/kernel.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ void kernel_main(void) {
print_welcome_screen();
while(inb(0x60) & 0x80){};
terminal_initialize();
struct kernel_time time = rtc_time();
printf("current time: %d:%d:%d %d:%d:%d%d\n", time.hour, time.minute, time.second, time.day, time.month, time.century, time.year);
show_time();
printf("cheaky>");
while(1) {
}
Expand Down

0 comments on commit 8361e96

Please sign in to comment.