]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
master,stats: Use time_t instead of unsigned long to count seconds
authorMartti Rannanjärvi <martti.rannanjarvi@dovecot.fi>
Fri, 6 Oct 2017 12:10:53 +0000 (15:10 +0300)
committerTimo Sirainen <tss@dovecot.fi>
Fri, 6 Oct 2017 13:04:28 +0000 (16:04 +0300)
src/master/main.c
src/stats/mail-stats.c

index a31e5736f08eaf7707d6f24e8afe3ce90ce1a31d..ad03bee8e6c220d92e406dc80f803cf69908e87c 100644 (file)
@@ -584,7 +584,7 @@ static const char *get_full_config_path(struct service_list *list)
 
 static void master_time_moved(time_t old_time, time_t new_time)
 {
-       unsigned long secs;
+       time_t secs;
 
        if (new_time >= old_time)
                return;
@@ -595,9 +595,9 @@ static void master_time_moved(time_t old_time, time_t new_time)
        if (secs > SERVICE_TIME_MOVED_BACKWARDS_MAX_THROTTLE_SECS)
                secs = SERVICE_TIME_MOVED_BACKWARDS_MAX_THROTTLE_SECS;
        services_throttle_time_sensitives(services, secs);
-       i_warning("Time moved backwards by %lu seconds, "
-                 "waiting for %lu secs until new services are launched again.",
-                 (unsigned long)(old_time - new_time), secs);
+       i_warning("Time moved backwards by %"PRIdTIME_T" seconds, waiting for "
+                 "%"PRIdTIME_T" secs until new services are launched again.",
+                 old_time - new_time, secs);
 }
 
 static void daemonize(void)
index e6052fb89cd697e2797700f78c92d7b625234ea3..e918c0be226d388fd49a6dd232bb578c59498279 100644 (file)
@@ -19,27 +19,27 @@ mail_global_stats_sent(void *ctx)
 static void
 mail_global_stats_send(void *u0 ATTR_UNUSED)
 {
-       unsigned long ts = (unsigned long)ioloop_time;
+       time_t ts = ioloop_time;
        if (*stats_settings->carbon_name != '\0' &&
            *stats_settings->carbon_server != '\0') {
                string_t *str = t_str_new(256);
                const char *prefix = t_strdup_printf("dovecot.%s.global",
                                                     stats_settings->carbon_name);
-               str_printfa(str, "%s.logins %u %lu\r\n", prefix,
+               str_printfa(str, "%s.logins %u %"PRIdTIME_T"\r\n", prefix,
                            mail_global_stats.num_logins, ts);
-               str_printfa(str, "%s.cmds %u %lu\r\n", prefix,
+               str_printfa(str, "%s.cmds %u %"PRIdTIME_T"\r\n", prefix,
                            mail_global_stats.num_cmds, ts);
-               str_printfa(str, "%s.connected_sessions %u %lu\r\n", prefix,
-                           mail_global_stats.num_connected_sessions,
+               str_printfa(str, "%s.connected_sessions %u %"PRIdTIME_T"\r\n",
+                           prefix, mail_global_stats.num_connected_sessions,
                            ts);
-               str_printfa(str, "%s.last_reset %lu %lu\r\n", prefix,
-                           mail_global_stats.reset_timestamp, ts);
+               str_printfa(str, "%s.last_reset %"PRIdTIME_T" %"PRIdTIME_T"\r\n",
+                           prefix, mail_global_stats.reset_timestamp, ts);
                /* then export rest of the stats */
                for(size_t i = 0; i < stats_field_count(); i++) {
                        str_printfa(str, "%s.%s ", prefix,
                                    stats_field_name(i));
                        stats_field_value(str, mail_global_stats.stats, i);
-                       str_printfa(str, " %lu\r\n", ts);
+                       str_printfa(str, " %"PRIdTIME_T"\r\n", ts);
                }
 
                /* and send them along */