Module: sip-router
Branch: master
Commit: a5cde5660a14e69ee71d69a6cc77c932c09915f9
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=a5cde56…
Author: Alex Hermann <alex(a)speakup.nl>
Committer: Alex Hermann <alex(a)speakup.nl>
Date: Mon Jan 10 15:41:42 2011 +0100
modules_k/pv: Make startup time available in a pseudovariable $Tb (boottime).
---
modules_k/pv/pv.c | 3 +++
modules_k/pv/pv_time.c | 9 +++++++++
modules_k/pv/pv_time.h | 2 ++
3 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/modules_k/pv/pv.c b/modules_k/pv/pv.c
index 77898cf..8009be7 100644
--- a/modules_k/pv/pv.c
+++ b/modules_k/pv/pv.c
@@ -364,6 +364,9 @@ static pv_export_t mod_pvs[] = {
{{"true", (sizeof("true")-1)}, /* */
PVT_OTHER, pv_get_true, 0,
0, 0, 0, 0},
+ {{"Tb", (sizeof("Tb")-1)}, /* */
+ PVT_OTHER, pv_get_timeb, 0,
+ 0, 0, 0, 0},
{{"Tf", (sizeof("Tf")-1)}, /* */
PVT_CONTEXT, pv_get_timef, 0,
0, 0, 0, 0},
diff --git a/modules_k/pv/pv_time.c b/modules_k/pv/pv_time.c
index 72ce234..72f1134 100644
--- a/modules_k/pv/pv_time.c
+++ b/modules_k/pv/pv_time.c
@@ -30,6 +30,7 @@
#include <sys/time.h>
#include "../../dprint.h"
+#include "../../globals.h"
#include "../../pvar.h"
#include "pv_time.h"
@@ -254,6 +255,14 @@ int pv_get_timef(struct sip_msg *msg, pv_param_t *param,
return pv_get_strintval(msg, param, res, &s, (int)t);
}
+int pv_get_timeb(struct sip_msg *msg, pv_param_t *param,
+ pv_value_t *res)
+{
+ if(msg==NULL)
+ return -1;
+ return pv_get_uintval(msg, param, res, (unsigned int)up_since);
+}
+
static struct timeval _timeval_ts;
static unsigned int _timeval_msg_id = 0;
static char _timeval_ts_buf[32];
diff --git a/modules_k/pv/pv_time.h b/modules_k/pv/pv_time.h
index d1ab6a9..cb7be93 100644
--- a/modules_k/pv/pv_time.h
+++ b/modules_k/pv/pv_time.h
@@ -40,6 +40,8 @@ int pv_get_times(struct sip_msg *msg, pv_param_t *param,
pv_value_t *res);
int pv_get_timef(struct sip_msg *msg, pv_param_t *param,
pv_value_t *res);
+int pv_get_timeb(struct sip_msg *msg, pv_param_t *param,
+ pv_value_t *res);
int pv_parse_timeval_name(pv_spec_p sp, str *in);
int pv_get_timeval(struct sip_msg *msg, pv_param_t *param,