From 11c6386331b8cfcd87ce917a6015c025acd8aa89 Mon Sep 17 00:00:00 2001 From: gazebo Date: Wed, 27 Mar 2019 17:51:19 +0800 Subject: [PATCH] - Float64TwoInt64 --- utils/typeconv.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/utils/typeconv.go b/utils/typeconv.go index 2136d3fc..3529a93b 100644 --- a/utils/typeconv.go +++ b/utils/typeconv.go @@ -5,6 +5,7 @@ import ( "encoding/json" "errors" "fmt" + "math" "net/url" "reflect" "strconv" @@ -276,6 +277,10 @@ func Int2Str(value int) string { return strconv.Itoa(value) } +func Float64TwoInt64(data float64) int64 { + return int64(math.Round(data)) +} + // timestamp is in second func Timestamp2Str(timestamp int64) string { return Time2Str(Timestamp2Time(timestamp))