\Header{difftime}{Time Intervals}
\alias{print.difftime}{difftime}
\alias{round.difftime}{difftime}
\keyword{utilities}{difftime}
\keyword{chron}{difftime}
\begin{Description}\relax
Create, print and round time intervals.\end{Description}
\begin{Usage}
\begin{verbatim}
time1 - time2
difftime(time1, time2, tz = "",
         units = c("auto", "secs", "mins", "hours", "days", "weeks"))
round(x, digits = 0)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{time1, time2}] date-time objects.
\item[\code{tz}] A timezone specification to be used for the conversion.
System-specific, but \code{""} is the current time zone, and
\code{"GMT"} is UTC.
\item[\code{units}] character.  Units in which the results are desired. Can
be abbreviated.
\item[\code{x}] An object inheriting from class \code{"difftime"}.
\item[\code{digits}] integer. Number of significant digits to retain.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
Function \code{difftime} takes a difference of two date/time objects
(of either class) and returns an object of class \code{"difftime"}
with an attribute indicating the units.  There is a \code{\Link{round}}
method for objects of this class.

If \code{units = "auto"}, a suitable set of units is chosen, the largest
possible (excluding \code{"weeks"}) in which all the absolute
differences are greater than one.

Subtraction of two date-time objects gives an object of this class,
by calling \code{difftime} with \code{units="auto"}.\end{Details}
\begin{SeeAlso}\relax
\code{\Link{DateTimeClasses}}.\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
(z <- Sys.time() - 3600)
Sys.time() - z                # just over 3600 seconds.

## time interval between releases of 1.2.2 and 1.2.3.
ISOdate(2001, 4, 26) - ISOdate(2001, 2, 26)
\end{ExampleCode}
\end{Examples}

