tcgl: code.google.com/p/tcgl/time Index | Files

package time

import "code.google.com/p/tcgl/time"

Time is a helpful package for working with times and dates.

Index

func DayInList

func DayInList(time time.Time, days []int) bool

DayInList tests if the day of a time is in a given list.

func DayInRange

func DayInRange(time time.Time, minDay, maxDay int) bool

DayInRange tests if a day of a time is in a given range.

func HourInList

func HourInList(time time.Time, hours []int) bool

HourInList tests if the hour of a time is in a given list.

func HourInRange

func HourInRange(time time.Time, minHour, maxHour int) bool

HourInRange tests if a hour of a time is in a given range.

func MinuteInList

func MinuteInList(time time.Time, minutes []int) bool

MinuteInList tests if the minute of a time is in a given list.

func MinuteInRange

func MinuteInRange(time time.Time, minMinute, maxMinute int) bool

MinuteInRange tests if a minute of a time is in a given range.

func MonthInList

func MonthInList(time time.Time, months []time.Month) bool

MonthInList tests if the month of a time is in a given list.

func MonthInRange

func MonthInRange(time time.Time, minMonth, maxMonth time.Month) bool

MonthInRange tests if a month of a time is in a given range.

func SecondInList

func SecondInList(time time.Time, seconds []int) bool

SecondInList tests if the second of a time is in a given list.

func SecondInRange

func SecondInRange(time time.Time, minSecond, maxSecond int) bool

SecondInRange tests if a second of a time is in a given range.

func WeekdayInList

func WeekdayInList(time time.Time, weekdays []time.Weekday) bool

WeekdayInList tests if the weekday of a time is in a given list.

func WeekdayInRange

func WeekdayInRange(time time.Time, minWeekday, maxWeekday time.Weekday) bool

WeekdayInRange tests if a weekday of a time is in a given range.

func YearInList

func YearInList(time time.Time, years []int) bool

YearInList test if the year of a time is in a given list.

func YearInRange

func YearInRange(time time.Time, minYear, maxYear int) bool

YearInRange tests if a year of a time is in a given range.

type CheckFunc

type CheckFunc func(time.Time) (bool, bool)

CheckFunc is the function type for checking if a job shall be performed now. It also returns if a job shall be deleted after execution.

type Crontab

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

Crontab is one cron server. A system can run multiple in parallel.

func NewCrontab

func NewCrontab() *Crontab

NewCrontab creates a cron server.

func (*Crontab) AddJob

func (c *Crontab) AddJob(id string, cf CheckFunc, tf TaskFunc)

AddJob adds a new job to the server.

func (*Crontab) DeleteJob

func (c *Crontab) DeleteJob(id string)

DeleteJob removes a job from the server.

func (*Crontab) Stop

func (c *Crontab) Stop()

Stop terminates the server.

type TaskFunc

type TaskFunc func(string)

TaskFunc is the function type that will be performed if a jobs check func returns true.

Files

doc.go time.go

Package time imports 1 packages (graph). Updated 2013-04-04. Refresh.