Skip to contentSkip to conversation

monitor-mux: fix timestamp prefixes

PATCH Applied Jan Kiszka 2 participants 2 messages Jan 20, 2009 – Jan 22, 2009

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 monitor-mux: fix timestamp prefixes

rt_clock returns milliseconds. Fix mux'ed monitor terminal timestamps accordingly.

---

 qemu-char.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
qemu-char.c +2 -2
index ac431c7..f849187 100644
@@ -241,13 +241,13 @@ static int mux_chr_write(CharDriverState *chr, const uint8_t *buf, int len)
                 if (term_timestamps_start == -1)
                     term_timestamps_start = ti;
                 ti -= term_timestamps_start;
-                secs = ti / 1000000000;
+                secs = ti / 1000;
                 snprintf(buf1, sizeof(buf1),
                          "[%02d:%02d:%02d.%03d] ",
                          secs / 3600,
                          (secs / 60) % 60,
                          secs % 60,
-                         (int)((ti / 1000000) % 1000));
+                         (int)(ti % 1000));
                 d->drv->chr_write(d->drv, (uint8_t *)buf1, strlen(buf1));
             }
         }
#1 lore raw
Quoted 5 lines · Jan Kiszka

rt_clock returns milliseconds. Fix mux'ed monitor terminal timestamps accordingly.

Applied. Thanks.

Regards,

Anthony Liguori

Quoted 29 lines

---

 qemu-char.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
qemu-char.c +2 -2
index ac431c7..f849187 100644
@@ -241,13 +241,13 @@ static int mux_chr_write(CharDriverState *chr, const uint8_t *buf, int len)
                 if (term_timestamps_start == -1)
                     term_timestamps_start = ti;
                 ti -= term_timestamps_start;
-                secs = ti / 1000000000;
+                secs = ti / 1000;
                 snprintf(buf1, sizeof(buf1),
                          "[%02d:%02d:%02d.%03d] ",
                          secs / 3600,
                          (secs / 60) % 60,
                          secs % 60,
-                         (int)((ti / 1000000) % 1000));
+                         (int)(ti % 1000));
                 d->drv->chr_write(d->drv, (uint8_t *)buf1, strlen(buf1));
             }
         }