time2

package
v0.0.0-...-6830f0b Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2015 License: BSD-3-Clause Imports: 1 Imported by: 0

Documentation

Overview

time2 is a collection of functions meant to supplement the capabilities provided by the standard "time" package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NowFloat

func NowFloat() float64

Return the time as a float64, ala Python's time.time().

func TimeToFloat

func TimeToFloat(t time.Time) float64

Convert Time to epoch seconds with subsecond precision.

Types

type MockClock

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

A fake clock useful for testing timing.

func (*MockClock) Advance

func (c *MockClock) Advance(delta time.Duration)

Advances the mock clock by the specified duration.

func (*MockClock) Now

func (c *MockClock) Now() time.Time

Returns the fake current time.

func (*MockClock) NowFloat

func (c *MockClock) NowFloat() float64

Returns the fake current time in epoch seconds.

func (*MockClock) Reset

func (c *MockClock) Reset()

Resets the mock clock back to initial state.

func (*MockClock) Set

func (c *MockClock) Set(t time.Time)

Set the mock clock to a specific time.

func (*MockClock) Since

func (c *MockClock) Since(t time.Time) time.Duration

Returns the time elapsed since the fake current time.

Jump to

Keyboard shortcuts

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