mirror of
https://github.com/hanzoai/o11y.git
synced 2026-10-15 12:58:33 +00:00
* feat: return all spans for flamegraph under a limit * feat: increase fg limits and add timestamp boundaries * fix: set default value for ts boundary * fix: use correct value for boundary end ts * chore: change info log of flamegraph to debug
18 lines
440 B
Go
18 lines
440 B
Go
package timestamp
|
|
|
|
import "time"
|
|
|
|
// FromTime returns a new millisecond timestamp from a time.
|
|
func FromTime(t time.Time) int64 {
|
|
return t.Unix()*1000 + int64(t.Nanosecond())/int64(time.Millisecond)
|
|
}
|
|
|
|
// Time returns a new time.Time object from a millisecond timestamp.
|
|
func Time(ts int64) time.Time {
|
|
return time.Unix(ts/1000, (ts%1000)*int64(time.Millisecond))
|
|
}
|
|
|
|
func MilliToNano(milliTS uint64) uint64 {
|
|
return milliTS * 1000_000
|
|
}
|