[svn-commits] mjordan: trunk r434284 - in /trunk: ./ cel/ configs/samples/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Apr 8 06:35:58 CDT 2015


Author: mjordan
Date: Wed Apr  8 06:35:53 2015
New Revision: 434284

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=434284
Log:
cel_pgsl: Add support for GMT timestamps

This patch adds a new option to cel_pgsl, "usegmtime", which causes timestamps
to be logged in GMT.

Review: https://reviewboard.asterisk.org/r/4571/

ASTERISK-23186 #close
Reported by: Rodrigo Ramirez Norambuena
patches:
  cel_pgsql.c_add_usegmtime2.patch submitted by Rodrigo Ramirez Norambuena (License 6577)


Modified:
    trunk/CHANGES
    trunk/cel/cel_pgsql.c
    trunk/configs/samples/cel_pgsql.conf.sample

Modified: trunk/CHANGES
URL: http://svnview.digium.com/svn/asterisk/trunk/CHANGES?view=diff&rev=434284&r1=434283&r2=434284
==============================================================================
--- trunk/CHANGES (original)
+++ trunk/CHANGES Wed Apr  8 06:35:53 2015
@@ -105,6 +105,15 @@
  * Added preferchannelclass=no option to prefer the application-passed class
    over the channel-set musicclass. This allows separate hold-music from
    application (e.g. Queue or Dial) specified music.
+
+
+CEL Backends
+------------------
+
+cel_pgsql
+------------------
+* Added a new option, 'usegmtime', which causes timestamps in CEL events
+  to be logged in GMT.
 
 ------------------------------------------------------------------------------
 --- Functionality changes from Asterisk 13.3.0 to Asterisk 13.4.0 ------------

Modified: trunk/cel/cel_pgsql.c
URL: http://svnview.digium.com/svn/asterisk/trunk/cel/cel_pgsql.c?view=diff&rev=434284&r1=434283&r2=434284
==============================================================================
--- trunk/cel/cel_pgsql.c (original)
+++ trunk/cel/cel_pgsql.c Wed Apr  8 06:35:53 2015
@@ -72,6 +72,7 @@
 
 static int connected = 0;
 static int maxsize = 512, maxsize2 = 512;
+static int usegmtime = 0;
 
 /*! \brief show_user_def is off by default */
 #define CEL_SHOW_USERDEF_DEFAULT	0
@@ -166,7 +167,7 @@
 
 	ast_mutex_lock(&pgsql_lock);
 
-	ast_localtime(&record.event_time, &tm, NULL);
+	ast_localtime(&record.event_time, &tm, usegmtime ? "GMT" : NULL);
 	ast_strftime(timestr, sizeof(timestr), DATE_FORMAT, &tm);
 
 	if ((!connected) && pghostname && pgdbuser && pgpassword && pgdbname) {
@@ -215,7 +216,7 @@
 				} else {
 					/* char, hopefully */
 					LENGTHEN_BUF2(31);
-					ast_localtime(&record.event_time, &tm, NULL);
+					ast_localtime(&record.event_time, &tm, usegmtime ? "GMT" : NULL);
 					ast_strftime(buf, sizeof(buf), DATE_FORMAT, &tm);
 					ast_str_append(&sql2, 0, "%s'%s'", SEP, buf);
 				}
@@ -515,6 +516,11 @@
 	if ((tmp = ast_variable_retrieve(cfg, "global", "show_user_defined"))) {
 		cel_show_user_def = ast_true(tmp) ? 1 : 0;
 	}
+	if ((tmp = ast_variable_retrieve(cfg, "global", "usegmtime"))) {
+		usegmtime = ast_true(tmp);
+	} else {
+		usegmtime = 0;
+	}
 	if (option_debug) {
 		if (ast_strlen_zero(pghostname)) {
 			ast_debug(3, "cel_pgsql: using default unix socket\n");

Modified: trunk/configs/samples/cel_pgsql.conf.sample
URL: http://svnview.digium.com/svn/asterisk/trunk/configs/samples/cel_pgsql.conf.sample?view=diff&rev=434284&r1=434283&r2=434284
==============================================================================
--- trunk/configs/samples/cel_pgsql.conf.sample (original)
+++ trunk/configs/samples/cel_pgsql.conf.sample Wed Apr  8 06:35:53 2015
@@ -59,10 +59,13 @@
 ;
 ;show_user_defined=yes
 
+; Log date/time in GMT. The default of this option is 'no'.
+;usegmtime=yes
+
 ;hostname=localhost
 ;port=5432
 ;dbname=asterisk
 ;password=password
 ;user=postgres
 ;table=cel		;SQL table where CEL's will be inserted
-;appname=asterisk   ; Postgres application_name support (optional). Whitespace not allowed.
+;appname=asterisk   ; Postgres application_name support (optional). Whitespace not allowed.




More information about the svn-commits mailing list