mirror of
https://github.com/andwati/telecom-platform.git
synced 2026-11-20 02:58:46 +00:00
feat: Add millisToDuration utility function for converting milliseconds to time.Duration with zero handling
This commit is contained in:
@@ -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
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user