Commit f3f64c26 authored by Dag Erling Smørgrav's avatar Dag Erling Smørgrav

Implement "now" and "obj.lastuse", with a note to the effect that the use

of timestamps and clock_gettime() throughout Varnish needs reviewing (as
per IRC discussion with phk)


git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@1630 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent c857d2c7
......@@ -304,3 +304,28 @@ VRT_l_req_hash(struct sess *sp, const char *str)
sp->hash_e[l] = '#';
sp->hash_e += l + 1;
}
/*--------------------------------------------------------------------*/
double
VRT_r_now(struct sess *sp)
{
struct timespec now;
(void)sp;
/* XXX use of clock_gettime() needs review */
clock_gettime(CLOCK_MONOTONIC, &now);
return (now.tv_sec);
}
double
VRT_r_obj_lastuse(struct sess *sp)
{
struct timespec now;
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
CHECK_OBJ_NOTNULL(sp->obj, OBJECT_MAGIC); /* XXX */
/* XXX use of clock_gettime() needs review */
clock_gettime(CLOCK_MONOTONIC, &now);
return (now.tv_sec - sp->obj->lru_stamp);
}
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