aboutsummaryrefslogtreecommitdiff
path: root/kernel/clock.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/clock.c')
-rw-r--r--kernel/clock.c31
1 files changed, 12 insertions, 19 deletions
diff --git a/kernel/clock.c b/kernel/clock.c
index 4515d55..b96ac74 100644
--- a/kernel/clock.c
+++ b/kernel/clock.c
@@ -16,6 +16,7 @@
*/
#include <stdint.h>
+#include <stdio.h>
#include <avr/io.h>
#include <stdio.h>
#include <stdlib.h>
@@ -25,29 +26,21 @@
void
clock(void *arg)
{
- struct clockarg *a = arg;
- uint8_t d, h, m, s;
+ uint8_t d, h, m, s, ds;
- d = h = m = s = 0;
+ d = h = m = s = ds = 0;
for (;;) {
- s += 1;
- if (s == 60) {
- s = 0;
- m += 1;
- }
- if (m == 60) {
- m = 0;
- h += 1;
- }
- if (h == 24) {
- h = 0;
- d += 1;
- }
+ ++ds;
+ if (ds == 10) { ds = 0; ++s; }
+ if (s == 60) { s = 0; ++m; }
+ if (m == 60) { m = 0; ++h; }
+ if (h == 24) { h = 0; ++d; }
- sprintf(a->lcd->first, "%8lx%8x", now(), a->adc->value[0]);
- sprintf(a->lcd->second, "%4d:%.2d:%.2d:%.2d", d, h, m, s);
+ wait(0);
+ fprintf(stderr, "\r%4d:%.2d:%.2d:%.2d.%1d ", d, h, m, s, ds);
+ signal(0);
- sleep(SEC(1));
+ sleep(SEC1(1));
}
}