cstime

package
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2025 License: MIT Imports: 6 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseDurationWithDays added in v0.0.19

func ParseDurationWithDays(input string) (time.Duration, error)

ParseDuration parses a string representing a duration, and supports days as a unit (e.g., "2d", "2d3h", "24h", "2h45m").

Types

type DurationWithDays added in v0.0.19

type DurationWithDays time.Duration

DurationWithDays wraps time.Duration and supports parsing with "d" for days.

func (DurationWithDays) Hours added in v0.0.19

func (d DurationWithDays) Hours() float64

Hours returns the duration as a floating point number of hours.

func (DurationWithDays) MarshalJSON added in v0.0.19

func (d DurationWithDays) MarshalJSON() ([]byte, error)

MarshalJSON outputs a quoted string.

func (DurationWithDays) MarshalText added in v0.0.19

func (d DurationWithDays) MarshalText() ([]byte, error)

MarshalText returns the standard duration string.

func (DurationWithDays) Milliseconds added in v0.0.19

func (d DurationWithDays) Milliseconds() int64

Milliseconds returns the duration as an integer millisecond count.

func (DurationWithDays) Minutes added in v0.0.19

func (d DurationWithDays) Minutes() float64

Minutes returns the duration as a floating point number of minutes.

func (DurationWithDays) Nanoseconds added in v0.0.19

func (d DurationWithDays) Nanoseconds() int64

Nanoseconds returns the duration as an integer nanosecond count.

func (DurationWithDays) Seconds added in v0.0.19

func (d DurationWithDays) Seconds() float64

Seconds returns the duration as a floating point number of seconds.

func (*DurationWithDays) Set added in v0.0.19

func (d *DurationWithDays) Set(s string) error

Set implements the pflag.Value interface.

func (DurationWithDays) String added in v0.0.19

func (d DurationWithDays) String() string

String returns the standard time.Duration string.

func (DurationWithDays) Type added in v0.0.19

func (DurationWithDays) Type() string

Type returns the type name for Cobra flags.

func (*DurationWithDays) UnmarshalJSON added in v0.0.19

func (d *DurationWithDays) UnmarshalJSON(b []byte) error

UnmarshalJSON expects a quoted duration string like "2d3h".

func (*DurationWithDays) UnmarshalText added in v0.0.19

func (d *DurationWithDays) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler (used by YAML/JSON libs).

Jump to

Keyboard shortcuts

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