diff options
-rw-r--r-- | applications/clock/source/main.cpp | 13 | ||||
-rw-r--r-- | makefile | 2 |
2 files changed, 8 insertions, 7 deletions
diff --git a/applications/clock/source/main.cpp b/applications/clock/source/main.cpp index fde8f33..12ef195 100644 --- a/applications/clock/source/main.cpp +++ b/applications/clock/source/main.cpp @@ -5,9 +5,7 @@ static daguerre::fixed_font<bool> *font; -std::string the_time() { - - time_t t = time(0); +std::string time_to_string(time_t t) { //convert to edt - TODO: timezones in euler t -= 4 * 3600 * 1024; @@ -43,8 +41,10 @@ int main() { font = new daguerre::fixed_font<bool>( daguerre::try_load_psf("/assets/terminus/10x18-bold.psf").value()); + time_t t = euler::syscall::get_time(); + pake::widgets::fixed_text *text = - new pake::widgets::fixed_text(the_time(), font, + new pake::widgets::fixed_text(time_to_string(t), font, euler::syscall::encode_color(0xaa, 0xaa, 0xaa), euler::syscall::encode_color(0x00, 0x00, 0x00), pake::halign::center, pake::valign::center); @@ -55,8 +55,9 @@ int main() { w.show(); while (1) { - euler::syscall::sleep(512); - text->set_text(the_time()); + euler::syscall::sleep(1024 - t % 1024); + t = euler::syscall::get_time(); + text->set_text(time_to_string(t)); w.render_and_send_to_compositor(); } @@ -1,6 +1,6 @@ # arguments are not strictly necessary to build -CC_EXTRA_ARGS = -Wall -Wextra -Og -ggdb +CC_EXTRA_ARGS = -Wall -Wextra -O3 -ggdb .PHONY: default default: build/disk.iso |