little.time

package little.time

Type members

Classlikes

sealed trait CronSchedule extends Schedule

Defines cron-like utility for scheduled times.

Defines cron-like utility for scheduled times.

Scheduled Times

CronSchedule determines its scheduled times using fields, where each field is a sorted sequence of distinct values specifying a component of time.

The times field specifies local times in schedule. It must include at least one value.

The daysOfMonth field specifies days of month in schedule. If empty, then every day is implied unless daysOfWeek is non-empty.

The months field specifies months in schedule. If empty, then every month is implied.

The daysOfWeek field specifies days of week in schedule. If empty, then every day is implied unless daysOfMonth is non-empty.

If both daysOfMonth and daysOfWeek are non-empty, then scheduled times are determined as a union of both fields.

import java.time.LocalTime.NOON
import java.time.Month.{ OCTOBER, NOVEMBER, DECEMBER }

import little.time.CronSchedule
import little.time.Implicits.TimeStringType

// Create schedule
val schedule = CronSchedule(
 times       = Seq(NOON),
 daysOfMonth = Seq(1, 15),
 months      = Seq(OCTOBER, NOVEMBER, DECEMBER))

val start = "2020-10-01".toLocalDate
val end   = "2020-12-31".toLocalDate

// Iterate over scheduled times
schedule.between(start, end).foreach { time =>
 println(s"${time.toLocalDate} at ${time.toLocalTime}")
}

// Create schedule using cron-like syntax
val altSchedule = CronSchedule("0 12 1,15 Oct-Dec *")
Companion
object
object CronSchedule

Provides CronSchedule factory.

Provides CronSchedule factory.

Companion
class
object Implicits

Provides extension methods to java.time.

Provides extension methods to java.time.

trait Schedule

Defines utility for scheduled times.

Defines utility for scheduled times.

Companion
object
object Schedule

Provides Schedule factory.

Provides Schedule factory.

Companion
class
sealed trait TimePrecision extends Ordered[TimePrecision]

Specifies precision of time.

Specifies precision of time.

Companion
object

Provides available TimePrecisions .

Provides available TimePrecisions .

Companion
class