timetool

package
v0.0.0-...-028f1de Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 1, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UnknownTimezoneName = "unknown"
)

Variables

View Source
var (
	ErrDetectSystemTimezoneName = errors.New("failed to detect TZ name in system")
)

Functions

func ApiTimeFormat

func ApiTimeFormat(t time.Time) string

func GetAccurateTime

func GetAccurateTime() int64

GetAccurateTime returns current time in millisecond precision

func GetCurrentTimezoneName

func GetCurrentTimezoneName() (string, error)

GetCurrentTimezoneName returns full name in TZ database of system timezone setting. On *nix systems, cases below should be taken in account:

  • When environment variable $TZ is absent, /etc/localtime should be used, which is mostly a symbolic link to tzfile under sources.
  • $TZ=""

func NowWithTimezoneName

func NowWithTimezoneName() (time.Time, int, string)

func ParseApiTime

func ParseApiTime(s string) (t time.Time, err error)

func ToAccurateTime

func ToAccurateTime(t time.Time) int64

ToAccurateTime returns specified time object in millisecond precision

func ToStableElapsedTime

func ToStableElapsedTime(t time.Time, base time.Time) time.Time

func UtcNowStr

func UtcNowStr() string

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL