mirror of
https://github.com/logos-messaging/logos-messaging-go.git
synced 2026-01-08 17:03:09 +00:00
15 lines
393 B
Go
15 lines
393 B
Go
package utils
|
|
|
|
import "time"
|
|
|
|
// GetUnixEpochFrom converts a time into a unix timestamp with nanoseconds
|
|
func GetUnixEpochFrom(now time.Time) int64 {
|
|
return now.UnixNano()
|
|
}
|
|
|
|
// GetUnixEpoch returns the current time in unix timestamp with the integer part
|
|
// representing seconds and the decimal part representing subseconds
|
|
func GetUnixEpoch() int64 {
|
|
return GetUnixEpochFrom(time.Now())
|
|
}
|