dur

package module
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2023 License: MIT Imports: 4 Imported by: 5

README

dur

duration helpers

Documentation

Index

Constants

View Source
const (
	DurHH        = "%vh"
	DurMM        = "%vm"
	DurSS        = "%vs"
	DurMMSS      = "%vm%vs"
	DurHHMMSS    = "%vh%vm%vs"
	DurHHMMSSsss = "%vh%vm%v.%vs"
	DurCuestamp  = "%vm%vs"
	DurTimestamp = "%vh%vm%vs"
	DurFullStamp = "%vh%vm%v.%vs"
)
View Source
const (
	ScanHH        = "%d"
	ScanMM        = "%d"
	ScanSS        = "%d"
	ScanMMSS      = "%d:%d"
	ScanHHMMSS    = "%d:%d:%d"
	ScanHHMMSSsss = "%d:%d:%d.%d"
	ScanCuestamp  = "%d:%d"
	ScanTimestamp = "%d:%d:%d"
	ScanFullStamp = "%d:%d:%d.%d"
)
View Source
const (
	StampHH        = "%02v"
	StampMM        = "%02v"
	StampSS        = "%02v"
	StampMMSS      = "%02v:%02v"
	StampHHMMSS    = "%02v:%02v:%02v"
	StampHHMMSSsss = "%02v:%02v:%02v.%03v"
	StampCuestamp  = "%02v:%02v"
	StampTimestamp = "%02v:%02v:%02v"
	StampFullStamp = "%02v:%02v:%02v.%03v"
)

Variables

This section is empty.

Functions

func Format

func Format(format Stamp, d time.Duration) (string, error)

func FormatDuration

func FormatDuration(format Stamp, times ...int) (string, error)

func FormatStamp

func FormatStamp(format Stamp, times ...int) (string, error)

func Parse

func Parse(format Stamp, dur string) (time.Duration, error)

func SplitDurString

func SplitDurString(format Stamp, dur string) ([]int, error)

func SplitTimestamp

func SplitTimestamp(format Stamp, dur string) ([]int, error)

Types

type Stamp

type Stamp string
const (
	HH           Stamp = "15"
	MM           Stamp = "04"
	SS           Stamp = "05"
	MMSS         Stamp = "00:00"
	HHMMSS       Stamp = "00:00:00"
	HHMMSSsss    Stamp = "00:00:00.000"
	Sec          Stamp = "15"
	Min          Stamp = "04"
	Hour         Stamp = "05"
	CueStamp     Stamp = "00:00"
	TimeStamp    Stamp = "00:00:00"
	DecimalStamp Stamp = "00:00:00.000"
)

func (Stamp) DurFmt

func (ts Stamp) DurFmt() string

func (Stamp) Format

func (ts Stamp) Format(d time.Duration) (string, error)

func (Stamp) Join added in v0.0.12

func (ts Stamp) Join(times ...int) (time.Duration, error)

func (Stamp) Parse

func (ts Stamp) Parse(dur string) (time.Duration, error)

func (Stamp) ScanFmt

func (ts Stamp) ScanFmt() string

func (Stamp) Split added in v0.0.12

func (ts Stamp) Split(t string) ([]int, error)

func (Stamp) StampFmt

func (ts Stamp) StampFmt() string

Jump to

Keyboard shortcuts

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