Index: include/asterisk/pbx.h
===================================================================
--- include/asterisk/pbx.h (revision 163765)
+++ include/asterisk/pbx.h (working copy)
@@ -119,6 +119,7 @@
unsigned int daymask; /*!< Mask for date */
unsigned int dowmask; /*!< Mask for day of week (mon-sun) */
unsigned int minmask[24]; /*!< Mask for minute */
+ char *timezone; /*!< NULL, or zoneinfo style timezone */
};
int ast_build_timing(struct ast_timing *i, const char *info);
Index: main/pbx.c
===================================================================
--- main/pbx.c (revision 163765)
+++ main/pbx.c (working copy)
@@ -212,6 +212,7 @@
+
@@ -306,6 +307,7 @@
+
@@ -6813,8 +6815,9 @@
int ast_build_timing(struct ast_timing *i, const char *info_in)
{
- char info_save[256];
+ char info_save[strlen(info_in) + 1];
char *info;
+ int j, num_fields, last_sep = -1;
/* Check for empty just in case */
if (ast_strlen_zero(info_in))
@@ -6822,6 +6825,21 @@
/* make a copy just in case we were passed a static string */
ast_copy_string(info_save, info_in, sizeof(info_save));
info = info_save;
+
+ /* count the number of fields in the timespec */
+ for (j=0, num_fields=1; info[j] != '\0'; j++) {
+ if (info[j] == ',') {
+ last_sep = j;
+ num_fields++;
+ }
+ }
+
+ /* save the timezone, if it is specified */
+ if (num_fields == 5)
+ i->timezone = ast_strdup(info + last_sep + 1);
+ else
+ i->timezone = NULL;
+
/* Assume everything except time */
i->monthmask = 0xfff; /* 12 bits */
i->daymask = 0x7fffffffU; /* 31 bits */
@@ -6842,7 +6860,7 @@
struct ast_tm tm;
struct timeval now = ast_tvnow();
- ast_localtime(&now, &tm, NULL);
+ ast_localtime(&now, &tm, i->timezone);
/* If it's not the right month, return */
if (!(i->monthmask & (1 << tm.tm_mon)))
@@ -8400,7 +8418,7 @@
struct ast_timing timing;
if (ast_strlen_zero(data)) {
- ast_log(LOG_WARNING, "GotoIfTime requires an argument:\n