diff options
author | Jeremy Harris <jgh146exb@wizmail.org> | 2017-08-06 15:44:13 +0100 |
---|---|---|
committer | Jeremy Harris <jgh146exb@wizmail.org> | 2017-08-06 16:43:17 +0100 |
commit | 0f1a8658daf8689f0ef0afbb11d0cb589447a57d (patch) | |
tree | bdc50be908c1c095a19fd62f2b8ab65490edb780 /src | |
parent | cab0c27721a3c1f3a146e44bcc6462eefb9eb9e7 (diff) |
Logging: millisecond time on 'no MAIL' lines. Bug 2102
Diffstat (limited to 'src')
-rw-r--r-- | src/src/deliver.c | 2 | ||||
-rw-r--r-- | src/src/functions.h | 1 | ||||
-rw-r--r-- | src/src/globals.c | 2 | ||||
-rw-r--r-- | src/src/globals.h | 2 | ||||
-rw-r--r-- | src/src/smtp_in.c | 6 |
5 files changed, 6 insertions, 7 deletions
diff --git a/src/src/deliver.c b/src/src/deliver.c index e7ca9e054..0f2efbecf 100644 --- a/src/src/deliver.c +++ b/src/src/deliver.c @@ -1058,7 +1058,7 @@ return buf; } -static uschar * +uschar * string_timesince(struct timeval * then) { struct timeval diff; diff --git a/src/src/functions.h b/src/src/functions.h index 5b2a683b8..c9d00df10 100644 --- a/src/src/functions.h +++ b/src/src/functions.h @@ -460,6 +460,7 @@ extern uschar *string_nextinlist(const uschar **, int *, uschar *, int); extern uschar *string_open_failed(int, const char *, ...) PRINTF_FUNCTION(2,3); extern const uschar *string_printing2(const uschar *, BOOL); extern uschar *string_split_message(uschar *); +extern uschar *string_timesince(struct timeval *); extern uschar *string_unprinting(uschar *); #ifdef SUPPORT_I18N extern uschar *string_address_utf8_to_alabel(const uschar *, uschar **); diff --git a/src/src/globals.c b/src/src/globals.c index 894b59967..9abacff8c 100644 --- a/src/src/globals.c +++ b/src/src/globals.c @@ -1308,7 +1308,7 @@ BOOL smtp_check_spool_space = TRUE; int smtp_ch_index = 0; uschar *smtp_cmd_argument = NULL; uschar *smtp_cmd_buffer = NULL; -time_t smtp_connection_start = 0; +struct timeval smtp_connection_start = {0,0}; uschar smtp_connection_had[SMTP_HBUFF_SIZE]; int smtp_connect_backlog = 20; double smtp_delay_mail = 0.0; diff --git a/src/src/globals.h b/src/src/globals.h index 2d26bd0d7..bd8d14288 100644 --- a/src/src/globals.h +++ b/src/src/globals.h @@ -820,7 +820,7 @@ extern BOOL smtp_check_spool_space; /* TRUE to check SMTP SIZE value */ extern int smtp_ch_index; /* Index in smtp_connection_had */ extern uschar *smtp_cmd_argument; /* For all SMTP commands */ extern uschar *smtp_cmd_buffer; /* SMTP command buffer */ -extern time_t smtp_connection_start; /* Start time of SMTP connection */ +extern struct timeval smtp_connection_start; /* Start time of SMTP connection */ extern uschar smtp_connection_had[]; /* Recent SMTP commands */ extern int smtp_connect_backlog; /* Max backlog permitted */ extern double smtp_delay_mail; /* Current MAIL delay */ diff --git a/src/src/smtp_in.c b/src/src/smtp_in.c index 3d5ad863f..48437c380 100644 --- a/src/src/smtp_in.c +++ b/src/src/smtp_in.c @@ -1797,9 +1797,7 @@ for (i = 0; i < smtp_ch_index; i++) if (s) s[ptr] = 0; else s = US""; log_write(0, LOG_MAIN, "no MAIL in SMTP connection from %s D=%s%s", - host_and_ident(FALSE), - readconf_printtime( (int) ((long)time(NULL) - (long)smtp_connection_start)), - s); + host_and_ident(FALSE), string_timesince(&smtp_connection_start), s); } @@ -2353,7 +2351,7 @@ uschar *user_msg, *log_msg; uschar *code, *esc; uschar *p, *s, *ss; -smtp_connection_start = time(NULL); +gettimeofday(&smtp_connection_start, NULL); for (smtp_ch_index = 0; smtp_ch_index < SMTP_HBUFF_SIZE; smtp_ch_index++) smtp_connection_had[smtp_ch_index] = SCH_NONE; smtp_ch_index = 0; |