From ae24b7a1c6abf3c6dfc3866e6814f3e4cb7cfa26 Mon Sep 17 00:00:00 2001 From: nutcas3 Date: Wed, 22 Apr 2026 13:35:20 +0300 Subject: [PATCH] feat: Add millisToDuration utility function for converting milliseconds to time.Duration with zero handling --- apps/api-server/internal/handlers/util_time.go | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 apps/api-server/internal/handlers/util_time.go diff --git a/apps/api-server/internal/handlers/util_time.go b/apps/api-server/internal/handlers/util_time.go new file mode 100644 index 0000000..5a5ea6f --- /dev/null +++ b/apps/api-server/internal/handlers/util_time.go @@ -0,0 +1,10 @@ +package handlers + +import "time" + +func millisToDuration(ms int64) time.Duration { + if ms <= 0 { + return 0 + } + return time.Duration(ms) * time.Millisecond +}