From e8f6a4ec773c7d8b610b06a4eb84bc5aad443d03 Mon Sep 17 00:00:00 2001 From: Leander Beernaert Date: Fri, 7 Jul 2023 13:40:15 +0200 Subject: [PATCH] fix(GODT-2757): Do not use auto-formatting for elapsed command time This can cause non-ASCII symbols to be printed in the response which is not supported by the IMAP protocol. Closes: #375 --- internal/session/context.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/session/context.go b/internal/session/context.go index 97c88d05..58aae761 100644 --- a/internal/session/context.go +++ b/internal/session/context.go @@ -21,7 +21,10 @@ func startTimeFromContext(ctx context.Context) (time.Time, bool) { func okMessage(ctx context.Context) string { if startTime, ok := startTimeFromContext(ctx); ok { - return fmt.Sprintf("command completed in %v", time.Since(startTime)) + elapsed := time.Since(startTime) + microSec := elapsed.Microseconds() + + return fmt.Sprintf("command completed in %v microsec.", microSec) } return ""