times

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2023 License: MIT Imports: 2 Imported by: 3

Documentation

Overview

Package times 时间相关.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Hour

func Hour(yield func()) func() bool

Hour 整点运行,返回取消方法.

Example
package main

import (
	"time"

	"github.com/xuender/kit/logs"
	"github.com/xuender/kit/times"
)

func main() {
	logs.I.Println("start")

	cancel := times.Hour(func() {
		logs.I.Println("run")
	})

	go func() {
		time.Sleep(time.Second)
		cancel()
		logs.I.Println("stop")
	}()

	logs.I.Println("sleep")
	time.Sleep(2 * time.Second)
	logs.I.Println("end")

}
Output:

Types

This section is empty.

Jump to

Keyboard shortcuts

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