]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
config: Added support for SET_TIME_MSECS
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Sat, 7 May 2016 17:06:02 +0000 (20:06 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Sat, 7 May 2016 17:06:02 +0000 (20:06 +0300)
src/config/config-request.c

index f51145b86d5916eb9f45f302bf7d8f1ae9dca6d1..ceaa7823fbec49041f1af3078d7c2eb752848f8f 100644 (file)
@@ -76,6 +76,14 @@ static void config_export_time(string_t *str, unsigned int stamp)
        str_printfa(str, "%u %s", stamp, suffix);
 }
 
+static void config_export_time_msecs(string_t *str, unsigned int stamp_msecs)
+{
+       if ((stamp_msecs % 1000) == 0)
+               config_export_time(str, stamp_msecs/1000);
+       else
+               str_printfa(str, "%u ms", stamp_msecs);
+}
+
 bool config_export_type(string_t *str, const void *value,
                        const void *default_value,
                        enum setting_type type, bool dump_default,
@@ -98,7 +106,8 @@ bool config_export_type(string_t *str, const void *value,
        }
        case SET_UINT:
        case SET_UINT_OCT:
-       case SET_TIME: {
+       case SET_TIME:
+       case SET_TIME_MSECS: {
                const unsigned int *val = value, *dval = default_value;
 
                if (dump_default || dval == NULL || *val != *dval) {
@@ -109,6 +118,9 @@ bool config_export_type(string_t *str, const void *value,
                        case SET_TIME:
                                config_export_time(str, *val);
                                break;
+                       case SET_TIME_MSECS:
+                               config_export_time_msecs(str, *val);
+                               break;
                        default:
                                str_printfa(str, "%u", *val);
                                break;
@@ -252,6 +264,7 @@ settings_export(struct config_export_context *ctx,
                case SET_UINT:
                case SET_UINT_OCT:
                case SET_TIME:
+               case SET_TIME_MSECS:
                case SET_IN_PORT:
                case SET_STR_VARS:
                case SET_STR: