From 59513572ba4336428e377312d46f3388c426beb5 Mon Sep 17 00:00:00 2001 From: Daniel Ponte Date: Sat, 4 Jan 2025 11:00:41 -0500 Subject: [PATCH] Marshal CallDuration as ms --- pkg/calls/call.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/calls/call.go b/pkg/calls/call.go index 8c1617d..f55b30f 100644 --- a/pkg/calls/call.go +++ b/pkg/calls/call.go @@ -1,6 +1,7 @@ package calls import ( + "encoding/json" "fmt" "time" @@ -29,6 +30,10 @@ func (d CallDuration) MsInt32Ptr() *int32 { return &i } +func (d CallDuration) MarshalJSON() ([]byte, error) { + return json.Marshal(d.Duration().Milliseconds()) +} + func (d CallDuration) Seconds() int32 { return int32(time.Duration(d).Seconds()) }