diff --git a/src/configfile.c b/src/configfile.c index 07da79a..7b21bc7 100644 --- a/src/configfile.c +++ b/src/configfile.c @@ -31,6 +31,7 @@ #include #include #include "configfile.h" +#include "timestamp.h" #include "print.h" #include "rs485.h" #include "misc.h" @@ -148,7 +149,6 @@ static void config_get_bool(GKeyFile *key_file, gchar *group, gchar *key, bool * static void config_parse_keys(GKeyFile *key_file, char *group) { char *string = NULL; - bool boolean = false; config_get_string(key_file, group, "device", &config.device, NULL); config_get_integer(key_file, group, "baudrate", &option.baudrate, 0, INT_MAX); @@ -204,17 +204,16 @@ static void config_parse_keys(GKeyFile *key_file, char *group) g_free((void *)string); string = NULL; } - config_get_bool(key_file, group, "timestamp", &boolean); - if (boolean == true) + config_get_bool(key_file, group, "timestamp", (bool*) &option.timestamp); + if (option.timestamp != TIMESTAMP_NONE) { - option.timestamp = TIMESTAMP_24HOUR; - } - config_get_string(key_file, group, "timestamp-format", &string, "24hour", "24hour-start", "24hour-delta", "iso8601", "epoch", NULL); - if (string != NULL) - { - option_parse_timestamp(string, &option.timestamp); - g_free((void *)string); - string = NULL; + config_get_string(key_file, group, "timestamp-format", &string, "24hour", "24hour-start", "24hour-delta", "iso8601", "epoch", NULL); + if (string != NULL) + { + option_parse_timestamp(string, &option.timestamp); + g_free((void *)string); + string = NULL; + } } config_get_integer(key_file, group, "timestamp-timeout", &option.timestamp_timeout, 0, INT_MAX); config_get_bool(key_file, group, "log", &option.log); diff --git a/src/options.c b/src/options.c index e685690..40bcc23 100644 --- a/src/options.c +++ b/src/options.c @@ -998,7 +998,10 @@ void options_parse(int argc, char *argv[]) break; case 't': - option.timestamp = TIMESTAMP_24HOUR; + if (option.timestamp == TIMESTAMP_NONE) + { + option.timestamp = TIMESTAMP_24HOUR; + } break; case OPT_TIMESTAMP_FORMAT: