From 1ded95c813907217e5a5d1bf8e484b9e945c2fd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E8=8C=B6=E6=B8=85=E6=AC=A2?= Date: Thu, 13 Jan 2022 23:04:02 +0800 Subject: [PATCH] fix cost --- gin/util/responsed.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gin/util/responsed.go b/gin/util/responsed.go index 9fbb27c..bfe0065 100644 --- a/gin/util/responsed.go +++ b/gin/util/responsed.go @@ -27,7 +27,7 @@ func Response(ctx *gin.Context, code interface{}, message string, data interface "message": message, "data": data, "trace_id": ctx.GetString("trace_id"), - "cost": time.Since(time.Unix(ctx.GetInt64("start_time"), 0)).Milliseconds(), + "cost": time.Now().UnixMilli() - ctx.GetInt64("start_time"), } ctx.JSON(http.StatusOK, responseData) }