MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / pv_get_timef

Function pv_get_timef

pvar.c:538–556  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

536#define CTIME_BUFFER_SIZE 26
537
538static int pv_get_timef(struct sip_msg *msg, pv_param_t *param,
539 pv_value_t *res)
540{
541 static char ctime_bufs[CTIME_BUFFER_NO][CTIME_BUFFER_SIZE];
542 static char *buf;
543 static int ctime_buf_no = 0;
544 time_t t;
545 str s;
546
547 if(msg==NULL)
548 return -1;
549
550 t = time(NULL);
551 buf = ctime_bufs[ctime_buf_no];
552 ctime_buf_no = (ctime_buf_no + 1) % CTIME_BUFFER_NO;
553 s.s = ctime_r(&t, buf);
554 s.len = strlen(s.s)-1;
555 return pv_get_strintval(msg, param, res, &s, (int)t);
556}
557
558static int pv_get_msgid(struct sip_msg *msg, pv_param_t *param,
559 pv_value_t *res)

Callers

nothing calls this directly

Calls 1

pv_get_strintvalFunction · 0.85

Tested by

no test coverage detected