Commit 05b93afe authored by Geoff Simmons's avatar Geoff Simmons

varnishevent only uses the real clock; and a bugfix for format %t

parent 73909737
...@@ -65,9 +65,6 @@ typedef struct compiled_fmt_t { ...@@ -65,9 +65,6 @@ typedef struct compiled_fmt_t {
static compiled_fmt_t cformat, bformat, zformat; static compiled_fmt_t cformat, bformat, zformat;
/* Difference between the real and monotonic clocks */
static double TIM_real_mono_diff;
static char i_arg[BUFSIZ] = ""; static char i_arg[BUFSIZ] = "";
static int read_rx_hdr = 0, read_tx_hdr = 0, read_vcl_log = 0, static int read_rx_hdr = 0, read_tx_hdr = 0, read_vcl_log = 0,
...@@ -126,14 +123,11 @@ get_tm(logline_t *ll, struct tm * t) { ...@@ -126,14 +123,11 @@ get_tm(logline_t *ll, struct tm * t) {
date_rec = GET_HDR(ll, rx, "Date"); date_rec = GET_HDR(ll, rx, "Date");
} }
else if (B(ll->spec)) { else if (B(ll->spec)) {
if (TAG(ll,SLT_BackendReq).len if ((date_rec = GET_HDR(ll, tx, "Date")) == NULL)
&& (ts = get_fld(&TAG(ll,SLT_BackendReq), 2)) != NULL) tt = (time_t) ll->t;
tt = (time_t) (atol(ts) + TIM_real_mono_diff);
else
date_rec = GET_HDR(ll, tx, "Date");
} }
else else
tt = (time_t) (ll->t + TIM_real_mono_diff); tt = (time_t) ll->t;
if (date_rec) if (date_rec)
tt = TIM_parse(&date_rec->data[strlen("Date: ")]); tt = TIM_parse(&date_rec->data[strlen("Date: ")]);
...@@ -654,12 +648,10 @@ compile_fmt(char *format, compiled_fmt_t *fmt, unsigned spec, char *err) ...@@ -654,12 +648,10 @@ compile_fmt(char *format, compiled_fmt_t *fmt, unsigned spec, char *err)
add_fmt(fmt, os, n, format_t, NULL, 0); add_fmt(fmt, os, n, format_t, NULL, 0);
if (C(spec)) { if (C(spec)) {
ADD_TAG(fmt->tags, ReqEnd); ADD_TAG(fmt->tags, ReqEnd);
ADD_TAG(fmt->tags, RxHeader);
}
else if (B(spec)) {
ADD_TAG(fmt->tags, BackendReq);
ADD_TAG(fmt->tags, TxHeader); ADD_TAG(fmt->tags, TxHeader);
} }
else if (B(spec))
ADD_TAG(fmt->tags, RxHeader);
n++; n++;
break; break;
...@@ -821,8 +813,6 @@ FMT_Init(char *err) ...@@ -821,8 +813,6 @@ FMT_Init(char *err)
if (compile_fmt(config.zformat, &zformat, 0, err) != 0) if (compile_fmt(config.zformat, &zformat, 0, err) != 0)
return EINVAL; return EINVAL;
TIM_real_mono_diff = TIM_real() - TIM_mono();
strcpy(hit, "hit"); strcpy(hit, "hit");
strcpy(miss, "miss"); strcpy(miss, "miss");
strcpy(pass, "pass"); strcpy(pass, "pass");
......
...@@ -445,7 +445,7 @@ event(void *priv, enum VSL_tag_e tag, unsigned fd, ...@@ -445,7 +445,7 @@ event(void *priv, enum VSL_tag_e tag, unsigned fd,
assert(lp->vcl_log == NULL || lp->vcl_log->nrec == 0); assert(lp->vcl_log == NULL || lp->vcl_log->nrec == 0);
/* XXX: assert that all lp->tag[i].len == 0 ? */ /* XXX: assert that all lp->tag[i].len == 0 ? */
t = TIM_mono(); t = TIM_real();
fd_tbl[fd].ll = lp; fd_tbl[fd].ll = lp;
lp->state = DATA_OPEN; lp->state = DATA_OPEN;
lp->t = t; lp->t = t;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment