timeamount

package
v0.0.0-...-ac3bb21 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2013 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MILLISECONDS Timeframe = "milli"
	SECONDS                = "s"
	MINUTES                = "min"
	HOURS                  = "hr"
	DAYS                   = "d" //days is not totally correct as it does not handle DST atm.

)

Variables

View Source
var TrendrrEpoch, _ = time.Parse("Mon Jan 2 15:04:05 MST 2006", "Fri Dec 31 21:00:00 PST 1999")
View Source
var USEast, _ = time.LoadLocation("America/New_York")

Functions

func IsEasternDayLight

func IsEasternDayLight(time time.Time) bool

checks if the given time is in NYC daylight savings time.

Types

type Time

type Time struct {
	time.Time
	TimeAmount   TimeAmount
	TrendrrEpoch int64
}

wraps a regular Time struct to contain the TimeAmount and associated Epoch.

func NewTime

func NewTime(timeamount TimeAmount, time time.Time) Time

Creates a new time object

type TimeAmount

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

func New

func New(amount int, timeframe Timeframe) TimeAmount

Create a new timeamount

func Parse

func Parse(timeamount string) (TimeAmount, error)

parses a timeamount usually in the form 15 minutes

func (*TimeAmount) FromTrendrrEpoch

func (this *TimeAmount) FromTrendrrEpoch(epoch int64) Time

func (*TimeAmount) String

func (this *TimeAmount) String() string

func (*TimeAmount) ToDuration

func (this *TimeAmount) ToDuration() (time.Duration, error)

Translates to a regular duration

func (*TimeAmount) ToTime

func (this *TimeAmount) ToTime(time time.Time) Time

Translates a go time to a timeamount.Time

func (*TimeAmount) ToTrendrrEpoch

func (this *TimeAmount) ToTrendrrEpoch(time time.Time) int64

type Timeframe

type Timeframe string

Jump to

Keyboard shortcuts

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