stamp

package
v0.0.0-...-51d629d Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2016 License: BSD-3-Clause, BSD-3-Clause Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Timestamp

type Timestamp struct {
	Stamp time.Time
}

A timestamp is a simple Golang time structure

func New

func New() *Timestamp

Return a new, initialised Timestamp structure. The time is set to 'now'.

func (*Timestamp) Age

func (t *Timestamp) Age() int

Return how old, in seconds, this timestamp is

func (*Timestamp) GetStamp

func (t *Timestamp) GetStamp() time.Time

Return the current time value

func (*Timestamp) IsTimeSet

func (t *Timestamp) IsTimeSet() bool

Time is set when it is non-zero and it isn't equal to the Unix 'epoch'

func (*Timestamp) SetStamp

func (t *Timestamp) SetStamp(when time.Time)

Set the time stamp to the time passed to the function.

func (*Timestamp) Window

func (t *Timestamp) Window(winSeconds int) int

Determine if the age of this record is within a window of time. Return zero if it is, or the age difference if it isn't.

type Timestamper

type Timestamper interface {
	Check() error
	SetStamp(time.Time)
	GetStamp() time.Time
	Age() int
	Window(int) int
}

Jump to

Keyboard shortcuts

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