time

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2017 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package time extends the time package in the stdlib.

Index

Examples

Constants

View Source
const (
	MySQLDateTime = "2006-01-02 15:04:05"
)

Time format extensions for the ones in the standard library.

Variables

View Source
var SystemClock = ClockFunc(time.Now)

SystemClock returns the current system time.

Functions

This section is empty.

Types

type Clock

type Clock interface {
	// Now tells the actual time.
	Now() time.Time
}

Clock tells the time.

type ClockFunc added in v0.3.0

type ClockFunc func() time.Time

ClockFunc wraps an ordinary function and makes it a Clock.

func (ClockFunc) Now added in v0.3.0

func (f ClockFunc) Now() time.Time

Now calls the underlying function and returns the result.

type StoppedAt added in v0.3.0

type StoppedAt time.Time

StoppedAt shows the moment it has been stopped at.

Example
package main

import (
	"fmt"
	stdtime "time"

	"github.com/goph/stdlib/time"
)

func main() {
	t := stdtime.Date(2017, stdtime.May, 10, 22, 52, 0, 0, stdtime.UTC)
	clock := time.StoppedAt(t)

	fmt.Println(clock.Now())
}
Output:

2017-05-10 22:52:00 +0000 UTC

func (StoppedAt) Now added in v0.3.0

func (c StoppedAt) Now() time.Time

Now tells the time when it has been stopped.

Jump to

Keyboard shortcuts

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