From 1cc88f9d7d5a9d4f411e049b1f256e6ad8adb2b4 Mon Sep 17 00:00:00 2001 From: Benji Dial Date: Thu, 1 Aug 2024 16:15:49 -0400 Subject: change clock a little, change -Og to -O3 --- applications/clock/source/main.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'applications') 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 *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( 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(); } -- cgit v1.2.3