tdiff

package module
v1.2.2 Latest Latest
Warning

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

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

README

TDiff

Yum

Go Report Card License

What is this?

Dumb. No, honestly, this is a very dumb example of how to play with Time objects in Go. Do NOT use this for your own projects, it is merely sample code.

How to install

Open a terminal and run the following:

$ go get -u github.com/mjwhitta/tdiff
$ go install github.com/mjwhitta/tdiff/cmd/tdiff@latest

Usage

$ tdiff [-y] 1988-05-22 now

Documentation

Index

Constants

View Source
const Day time.Duration = 24 * time.Hour

Day is a Duration of 24 hours

View Source
const Version = "1.2.2"

Version is the package version

Variables

View Source
var RFC3339 *regexp.Regexp = regexp.MustCompile(
	`^(\d{4}-\d\d-\d\d(T\d\d:\d\d:\d\d)?|now)$`,
)

RFC3339 is a regex to validate user-input.

Functions

This section is empty.

Types

type TDiff

type TDiff struct {
	// contains filtered or unexported fields
}

TDiff is a struct to hold the different between two dates for future use.

func New

func New(ts1 string, ts2 string) (*TDiff, error)

New will return a new TDiff instance.

func (*TDiff) Days

func (t *TDiff) Days() string

Days will return a string showing the full time duration in days.

func (*TDiff) Hours

func (t *TDiff) Hours() string

Hours will return a string showing the full time duration in hours.

func (*TDiff) Microseconds

func (t *TDiff) Microseconds() string

Microseconds will return a string showing the full time duration in microseconds.

func (*TDiff) Milliseconds

func (t *TDiff) Milliseconds() string

Milliseconds will return a string showing the full time duration in milliseconds.

func (*TDiff) Minutes

func (t *TDiff) Minutes() string

Minutes will return a string showing the full time duration in minutes.

func (*TDiff) Months

func (t *TDiff) Months() string

Months will return a string showing the full time duration in months.

func (*TDiff) Nanoseconds

func (t *TDiff) Nanoseconds() string

Nanoseconds will return a string showing the full time duration in nanoseconds.

func (*TDiff) Seconds

func (t *TDiff) Seconds() string

Seconds will return a string showing the full time duration in seconds.

func (*TDiff) Years

func (t *TDiff) Years() string

Years will return a string showing the full time duration in years.

func (*TDiff) YearsShorthand

func (t *TDiff) YearsShorthand() string

YearsShorthand will return a string showing if < 1 year or > 1 year.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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