dur

package module
v0.0.11 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 int
const (
	HH Stamp = iota
	MM
	SS
	MMSS
	HHMMSS
	HHMMSSsss
	CueStamp
	TimeStamp
	FullStamp
)

func (Stamp) DurFmt

func (ts Stamp) DurFmt() string

func (Stamp) Format

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

func (Stamp) Parse

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

func (Stamp) ScanFmt

func (ts Stamp) ScanFmt() string

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