bigdur

package module
v0.0.0-...-48c437a Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2019 License: MIT Imports: 4 Imported by: 0

README

bigdur

A small Go package for parsing larger durations.

GoDoc

Install

go get -u go.coder.com/bigdur

Overview

A duration token consists of a series of coefficient and unit pairs.

For example:

  • 4d
  • 4m4s
  • 4mo2.2d5s

are valid.

The following units are available:

Abbreviation Description
s 1 second
m 60 seconds
h 60 minutes
d 24 hours
w 7 days
mo 30 days
y 12 months

Documentation

Overview

Package bigdur parses large durations. In addition to units supported by the standard library, It supports:

- d for 24 hours

- mo for 30 days

- y for 12 months

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Duration

type Duration uint64

Duration represents an interval of time.

func Parse

func Parse(str string) (Duration, error)

Parse parses a Duration.

func (Duration) Std

func (d Duration) Std() time.Duration

Duration converts into a standard library time.Duration.

func (Duration) String

func (d Duration) String() string

String returns a human-readable representation of Duration.

Jump to

Keyboard shortcuts

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