summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMichal Idziorek <m.i@gmx.at>2014-09-03 15:26:19 +0200
committerMichal Idziorek <m.i@gmx.at>2014-09-03 15:26:19 +0200
commite5e674724ec527c45efaa1622d0e9a1618757ca3 (patch)
treed7bd7a4d6c9b155b6828171b0a80be5b5bac79cd /lib
parentfcfa7a7537ed76a63896ec5a9aa39cfc989d761c (diff)
system clock
Diffstat (limited to 'lib')
-rw-r--r--lib/logger/log.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/logger/log.c b/lib/logger/log.c
index fd226e5..c9bb652 100644
--- a/lib/logger/log.c
+++ b/lib/logger/log.c
@@ -1,13 +1,24 @@
#include "log.h"
#include <stdarg.h>
+#include "lib/int/stdint.h"
void PutConsole(char *str, int color, va_list va);
+volatile uint64_t task_system_clock; // in task.c
+
void log(char *module_name, int log_level, char *format_string, ...)
{
if(log_level<FOOLOS_LOG_INFO)return;
+ char buf[10];
+ uint32_t t=task_system_clock;
+ uint32_t s=t/25;
+ uint32_t ms=t*1000/25-1000*s;
+
+ tfp_sprintf(buf,"[%6d.%05d] ",s,ms);
+
+ PutConsole(buf,0b0111101111101111,task_system_clock);
PutConsole(module_name,0b1111100000000000,0);
PutConsole(": ",0b0000011111100000,0);
va_list va;
@@ -19,6 +30,7 @@ void log(char *module_name, int log_level, char *format_string, ...)
}
+
void panic(char *module_name, char *format_string)
{
@@ -27,9 +39,6 @@ void panic(char *module_name, char *format_string)
PutConsole(" : ",0b0000011111100000,0);
PutConsole(format_string,0b1111100000000000,0);
-
while(1); // halt
-
-
}