diff options
Diffstat (limited to 'applications/clock/source')
-rw-r--r-- | applications/clock/source/main.cpp | 13 |
1 files changed, 7 insertions, 6 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(); } |