From ac5d1738eaec2ff5ac0e74bf371aab5f8e799eb6 Mon Sep 17 00:00:00 2001 From: Andrew Bauer Date: Mon, 21 Aug 2017 10:27:11 -0500 Subject: [PATCH] allow changing of the timestamp char code delimeter (#1972) --- .../lib/ZoneMinder/ConfigData.pm.in | 19 +++++++++++++++++++ src/zm_monitor.cpp | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in b/scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in index 43ff70eea..6df8a9927 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in +++ b/scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in @@ -700,6 +700,25 @@ our @options = ( type => $types{boolean}, category => 'config', }, + { + name => 'ZM_TIMESTAMP_CODE_CHAR', + default => '%', + description => 'Character to used to identify timestamp codes', + help => q` + There are a few codes one can use to tell ZoneMinder to insert + data into the timestamp of each image. Traditionally, the + percent (%) character has been used to identify these codes since + the current character codes do not conflict with the strftime + codes, which can also be used in the timestamp. While this works + well for Linux, this does not work well for BSD operating systems. + Changing the default character to something else, such as an + exclamation point (!), resolves the issue. Note this only affects + the timestamp codes built into ZoneMinder. It has no effect on + the family of strftime codes one can use. + `, + type => $types{string}, + category => 'config', + }, { name => 'ZM_CPU_EXTENSIONS', default => 'yes', diff --git a/src/zm_monitor.cpp b/src/zm_monitor.cpp index 56b4be9d1..47cda3cbd 100644 --- a/src/zm_monitor.cpp +++ b/src/zm_monitor.cpp @@ -2941,7 +2941,7 @@ void Monitor::TimestampImage( Image *ts_image, const struct timeval *ts_time ) c const char *s_ptr = label_time_text; char *d_ptr = label_text; while ( *s_ptr && ((d_ptr-label_text) < (unsigned int)sizeof(label_text)) ) { - if ( *s_ptr == '%' ) { + if ( *s_ptr == config.timestamp_code_char[0] ) { bool found_macro = false; switch ( *(s_ptr+1) ) { case 'N' :