cron

package
v1.43.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: MIT Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package cron reads the five fields of a cron expression, minute, hour, day of the month, month and day of the week, and tells the times they match.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Schedule

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

Schedule is the times a cron expression matches.

func Parse

func Parse(expr string) (*Schedule, error)

Parse reads expr, five fields apart by white space. Each field is *, a value, a range a-b, either with a step as */n or a-b/n, or a list of them apart by commas. A month and a day of the week can be named by the first three letters of their names in English.

func (*Schedule) Next

func (s *Schedule) Next(t time.Time) (time.Time, bool)

Next returns the first time after t that s matches, to the minute, on the wall clock of the location of t, and false when there is none in the five years after t. A time the clock skips, as it does when daylight saving time starts, is not matched. A time it shows twice, as it does when it ends, is matched once, unless the hour field starts with *: such a schedule is matched in both, as cron runs it.

Jump to

Keyboard shortcuts

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