fasttime

package
v3.0.0-pre-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotATimestamp = errors.New("not a slack timestamp")

Functions

func Int2TS

func Int2TS(ts int64) string

Int2TS converts an int64 to a slack timestamp by inserting a dot in the right place.

func Int2Time

func Int2Time(ts int64) time.Time

Int2Time converts an int64 to a time.Time.

func TS2int

func TS2int(ts string) (int64, error)

TS2int converts a slack timestamp to an int64 by stripping the dot and converting the string to an int64. It is useful for fast comparison.

Types

type Time

type Time time.Time

func (Time) MarshalJSON

func (t Time) MarshalJSON() ([]byte, error)

func (Time) SlackString

func (t Time) SlackString() string

SlackString returns the time as a slack timestamp (i.e. "1234567890.123456").

func (*Time) UnmarshalJSON

func (t *Time) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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