From 37cbb041c919b56c50ab0524a8d2e85843bc91ce Mon Sep 17 00:00:00 2001 From: Anton Dyudin Date: Thu, 19 Feb 2015 19:55:18 -0800 Subject: [PATCH] Fixed ford ot anchor at current main revision, not time --- n/t.c | 20 ++++++++++++++++++++ v/raft.c | 5 ++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/n/t.c b/n/t.c index 84eb5858bb..766a5a77ef 100644 --- a/n/t.c +++ b/n/t.c @@ -42,6 +42,26 @@ u3_lo_tank(c3_l tab_l, u3_noun tac); void u3t_slog(u3_noun hod) { + #ifdef GHETTO + + static int old; + static struct timeval b4, f2, d0; + c3_w ms_w; + + if ( old ) { + gettimeofday(&f2, 0); + timersub(&f2, &b4, &d0); + ms_w = (d0.tv_sec * 1000) + (d0.tv_usec / 1000); + if(ms_w > 10){ + printf("%3d.%dms ", ms_w, (d0.tv_usec % 1000) / 10); + gettimeofday(&b4, 0); + } + } + else gettimeofday(&b4, 0); + + old = 1; + + #endif if ( c3y == u3du(hod) ) { u3_noun pri = u3h(hod); diff --git a/v/raft.c b/v/raft.c index 852c02e688..1c474e7641 100644 --- a/v/raft.c +++ b/v/raft.c @@ -1573,11 +1573,14 @@ _raft_punk(u3_noun ovo) #ifdef GHETTO c3_w ms_w; + c3_w clr_w; gettimeofday(&f2, 0); timersub(&f2, &b4, &d0); ms_w = (d0.tv_sec * 1000) + (d0.tv_usec / 1000); - uL(fprintf(uH, "%%punk %s %d.%dms\n", txt_c, ms_w, (d0.tv_usec % 1000) / 10)); + clr_w = ms_w > 1000 ? 1 : ms_w < 100 ? 2 : 3; // red, green, yellow + uL(fprintf(uH, "\x1b[3%dm%%punk %s %d.%dms\x1b[0m\n", + clr_w, txt_c, ms_w, (d0.tv_usec % 1000) / 10)); free(txt_c); #endif