Skip to content

romansky/scron

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

scron Build Status

Cron format to time parsing implemented in scala

Usage

import com.uniformlyrandom.scron.Scron

val startTime = DateTime.now.getMillis
val endTime = startTime + ( 60 * 60 )

val times = Scron.parse("* * * * * *", startTime, endTime)
// times is now filled with epoch time for every second for the next hour
times.length == 60 * 60

Supported Cron Formatting

General Format

*	*	*	*	*	*
|	|	|	|	|	|day of week(0-6)
|	|	|	|	|month(1-12)
|	|	|	|day of month(1-31)
|	|	|hour(0-23)
|	|minute(0-59)
|seconds(0-59)

See WikiPedia for more information about the format

Supported Formatting Of Specific Fields

  • * all the options for that field
  • */2 starting from the first option, every other option
  • 0 only use the explicitly provided option
  • 2,4,9 use list of values provided, separated by comma

Installation

Using sbt, add to build.sbt

libraryDependencies ++= Seq(
    	"com.uniformlyrandom" %% "scron" % "1.0.0"
)

About

Scala cron parser

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages