timer

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2015 License: MPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var OverheadTimeline = "__overhead"

Functions

func SystemTimeglassPath

func SystemTimeglassPath() (string, error)

returns the system path were all timeglass related data is stored for this machine

func SystemTimeglassPathCreateIfNotExist

func SystemTimeglassPathCreateIfNotExist() (string, error)

Types

type Block

type Block struct {
	Staged bool          `json:"s"`
	Width  time.Duration `json:"w"`
	Time   time.Time     `json:"t"`
}

A block of time that is positioned on a timeline

type Distributor

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

A distributor managed various files for a single timer using timelines

func NewDistributor

func NewDistributor() *Distributor

func (*Distributor) Break

func (d *Distributor) Break()

func (*Distributor) Distribute

func (d *Distributor) Distribute(dur time.Duration, t time.Time)

func (*Distributor) Extract

func (d *Distributor) Extract(fpath string, upto time.Time) (time.Duration, error)

extract the time spent on a file from the first point a given point in time

func (*Distributor) MarshalJSON

func (d *Distributor) MarshalJSON() ([]byte, error)

func (*Distributor) Register

func (d *Distributor) Register(fpath string)

func (*Distributor) Reset

func (d *Distributor) Reset(opt ResetOpts)

func (*Distributor) Stage

func (d *Distributor) Stage(fpath string, upto time.Time)

stage blocks to be removed on the next .Reset(true)

func (*Distributor) Timelines

func (d *Distributor) Timelines() map[string]*Timeline

func (*Distributor) UnmarshalJSON

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

type Keeper

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

func NewKeeper

func NewKeeper(path string) (*Keeper, error)

func (*Keeper) Discard

func (k *Keeper) Discard(dir string) error

func (*Keeper) Inspect

func (k *Keeper) Inspect(dir string) (*Timer, error)

func (*Keeper) Load

func (k *Keeper) Load() error

func (*Keeper) MarshalJSON

func (k *Keeper) MarshalJSON() ([]byte, error)

func (*Keeper) Measure

func (k *Keeper) Measure(dir string) error

func (*Keeper) Save

func (k *Keeper) Save() error

func (*Keeper) Stop

func (k *Keeper) Stop()

func (*Keeper) UnmarshalJSON

func (k *Keeper) UnmarshalJSON(b []byte) error

type ResetOpts

type ResetOpts struct {
	Staged   bool
	Unstaged bool
}

type Timeline

type Timeline struct {
	Blocks []*Block `json:"b"`
}

A timeline holds a number of lines for a single file

func NewTimeline

func NewTimeline() *Timeline

func (*Timeline) Expand

func (tl *Timeline) Expand(w time.Duration, t time.Time)

func (*Timeline) Length

func (tl *Timeline) Length(upto time.Time) time.Duration

func (*Timeline) Stage

func (tl *Timeline) Stage(upto time.Time)

func (*Timeline) Staged

func (tl *Timeline) Staged() time.Duration

func (*Timeline) Unstaged

func (tl *Timeline) Unstaged() time.Duration

type Timer

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

a timer without explicit start and stop methods, let garbage collector remove any routines, channels etc when a refence is removed

func NewTimer

func NewTimer(dir string) (*Timer, error)

func (*Timer) Dir

func (t *Timer) Dir() string

func (*Timer) Distributor

func (t *Timer) Distributor() *Distributor

func (*Timer) Error

func (t *Timer) Error() error

func (*Timer) IsPaused

func (t *Timer) IsPaused() bool

func (*Timer) MarshalJSON

func (t *Timer) MarshalJSON() ([]byte, error)

func (*Timer) Pause

func (t *Timer) Pause()

func (*Timer) Reset

func (t *Timer) Reset(opt ResetOpts)

func (*Timer) SetSave

func (t *Timer) SetSave(ch chan struct{})

func (*Timer) Stage

func (t *Timer) Stage(files []*vcs.StagedFile)

func (*Timer) Start

func (t *Timer) Start()

func (*Timer) Stop

func (t *Timer) Stop()

func (*Timer) Time

func (t *Timer) Time() time.Duration

func (*Timer) UnmarshalJSON

func (t *Timer) UnmarshalJSON(b []byte) error

func (*Timer) Unpause

func (t *Timer) Unpause()

Jump to

Keyboard shortcuts

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