Digital Clock - Xiao-XC/C-Practice-Projects GitHub Wiki

Digital-Clock

Type: Bro Code course project Date: Sept 2026 Concepts: time_t, struct tm, localtime(), Sleep(), system("cls"), _kbhit() / _getch()

What it does

Displays the current local time, refreshing every second, with a non-blocking option to power off back to the menu. It was Bro Code's original final project and later became one feature of the Time-Utility-Program.

What I learned

My first version used scanf inside the refresh loop, which blocked and froze the clock while it waited for input. _kbhit() / _getch() fixed it because they check for a keypress without pausing. I also fixed a crash caused by passing *option to scanf instead of option: since option was already a pointer, dereferencing it passed a value where scanf needed an address.

Source

[View the code on GitHub](https://github.com/Xiao-XC/C-Practice-Projects/tree/main/Digital-Clock)

Back to Home