mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-07-28 00:02:00 +08:00
24 lines
379 B
Go
24 lines
379 B
Go
package querybuilder
|
|
|
|
import "math"
|
|
|
|
const (
|
|
NsToSeconds = 1000000000
|
|
BucketAdjustment = 1800 // 30 minutes
|
|
)
|
|
|
|
// ToNanoSecs takes epoch and returns it in ns
|
|
func ToNanoSecs(epoch uint64) uint64 {
|
|
temp := epoch
|
|
count := 0
|
|
if epoch == 0 {
|
|
count = 1
|
|
} else {
|
|
for epoch != 0 {
|
|
epoch /= 10
|
|
count++
|
|
}
|
|
}
|
|
return temp * uint64(math.Pow(10, float64(19-count)))
|
|
}
|