% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/linear_time.R
\name{new_linear_time_fn}
\alias{new_linear_time_fn}
\title{Linear time function factory}
\usage{
new_linear_time_fn(chronon, default_calendar = cal_gregorian)
}
\arguments{
\item{chronon}{A bare call for a time granule object representing the chronon
(e.g., \code{day(1)})}

\item{default_calendar}{A default calendar used to find the time units for
conversion if they don't exist in the calendar of the input data (e.g.,
\code{cal_isoweek} for week chronons to work with gregorian calendar inputs).}
}
\value{
A function used to create linear time points with a specific chronon.
}
\description{
\code{new_linear_time_fn()} creates a linear time function for a specified
chronon. A chronon is the smallest indivisible time granule (e.g., days,
hours).
}
\examples{

# Linear time with 1 month granules as the chronon
ym <- new_linear_time_fn(month(1L))
ym(Sys.Date())

# Linear time with 1 day granules as the chronon
yd <- new_linear_time_fn(day(1L))
yd(Sys.Date())

# Linear time with 1 week granules as the chronon, using the ISO week calendar
yw <- new_linear_time_fn(week(1L), default_calendar = cal_isoweek)
yw(Sys.Date())

# Linear time with 1 hour granules as the chronon
ymd_h <- new_linear_time_fn(hour(1L))
ymd_h(Sys.time())

}
