summaryrefslogtreecommitdiff
path: root/applications
diff options
context:
space:
mode:
authorBenji Dial <benji@benjidial.net>2024-08-01 16:15:49 -0400
committerBenji Dial <benji@benjidial.net>2024-08-01 16:15:49 -0400
commit1cc88f9d7d5a9d4f411e049b1f256e6ad8adb2b4 (patch)
tree4dbdcb9c3dc7be1d3f2cc0391bcb71eab277a278 /applications
parentcc9a1811fd93971ae8c0d3bdc8d60102ce58556e (diff)
downloadhilbert-os-1cc88f9d7d5a9d4f411e049b1f256e6ad8adb2b4.tar.gz
change clock a little, change -Og to -O3
Diffstat (limited to 'applications')
-rw-r--r--applications/clock/source/main.cpp13
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();
}