2021-10-12 13:12:54 +00:00
|
|
|
package utils
|
|
|
|
|
|
|
|
import "time"
|
|
|
|
|
2022-04-25 19:31:26 +00:00
|
|
|
// GetUnixEpochFrom converts a time into a unix timestamp with nanoseconds
|
2022-02-23 15:01:53 +00:00
|
|
|
func GetUnixEpochFrom(now time.Time) int64 {
|
|
|
|
return now.UnixNano()
|
2021-10-18 13:48:04 +00:00
|
|
|
}
|
|
|
|
|
2021-11-05 20:09:48 +00:00
|
|
|
// GetUnixEpoch returns the current time in unix timestamp with the integer part
|
|
|
|
// representing seconds and the decimal part representing subseconds
|
2022-02-23 15:01:53 +00:00
|
|
|
func GetUnixEpoch() int64 {
|
2021-11-05 20:09:48 +00:00
|
|
|
return GetUnixEpochFrom(time.Now())
|
2021-10-12 13:12:54 +00:00
|
|
|
}
|