[Asterisk-Users] ${EPOCH} and ${DATETIME} patch
Benjamin Miller
BGMiller at dccinc.com
Sun Apr 20 19:26:44 MST 2003
Skipped content of type multipart/alternative-------------- next part --------------
Index: pbx.c
===================================================================
RCS file: /usr/cvsroot/asterisk/pbx.c,v
retrieving revision 1.14
diff -u -r1.14 pbx.c
--- pbx.c 19 Apr 2003 02:41:22 -0000 1.14
+++ pbx.c 21 Apr 2003 02:27:43 -0000
@@ -713,6 +713,8 @@
{
char *first,*second;
char tmpvar[80] = "";
+ time_t thistime;
+ struct tm brokentime;
int offset,offset2;
struct ast_var_t *variables;
char *name, *num; /* for callerid name + num variables */
@@ -807,6 +809,21 @@
} else if (!strcmp(var, "CHANNEL")) {
strncpy(workspace, c->name, workspacelen - 1);
*ret = workspace;
+ } else if (!strcmp(var, "EPOCH")) {
+ snprintf(workspace, workspacelen -1, "%u",(int)time(NULL));
+ *ret = workspace;
+ } else if (!strcmp(var, "DATETIME")) {
+ thistime=time(NULL);
+ localtime_r(&thistime, &brokentime);
+ snprintf(workspace, workspacelen -1, "%02d%02d%04d-%02d:%02d:%02d",
+ brokentime.tm_mday,
+ brokentime.tm_mon+1,
+ brokentime.tm_year+1900,
+ brokentime.tm_hour,
+ brokentime.tm_min,
+ brokentime.tm_sec
+ );
+ *ret = workspace;
} else {
AST_LIST_TRAVERSE(headp,variables,entries) {
#if 0
More information about the asterisk-users
mailing list