File: git_time.Rd

package info (click to toggle)
r-cran-git2r 0.31.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 2,288 kB
  • sloc: ansic: 8,283; sh: 4,116; makefile: 4
file content (68 lines) | stat: -rw-r--r-- 2,152 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/time.R
\name{git_time}
\alias{git_time}
\alias{as.character.git_time}
\alias{format.git_time}
\alias{as.POSIXct.git_time}
\alias{print.git_time}
\title{Time}
\usage{
\method{as.character}{git_time}(x, tz = "GMT", origin = "1970-01-01", usetz = TRUE, ...)

\method{format}{git_time}(x, tz = "GMT", origin = "1970-01-01", usetz = TRUE, ...)

\method{as.POSIXct}{git_time}(x, tz = "GMT", origin = "1970-01-01", ...)

\method{print}{git_time}(x, tz = "GMT", origin = "1970-01-01", usetz = TRUE, ...)
}
\arguments{
\item{x}{\R  object to be converted.}

\item{tz}{time zone specification to be used for the conversion,
    \emph{if one is required}.  System-specific (see \link[base]{time zones}),
    but \code{""} is the current time zone, and \code{"GMT"} is UTC
    (Universal Time, Coordinated).  Invalid values are most commonly
    treated as UTC, on some platforms with a warning.}

\item{origin}{a date-time object, or something which can be coerced by
    \code{as.POSIXct(tz = "GMT")} to such an object.}

\item{usetz}{logical.  Should the time zone abbreviation be appended
    to the output?  This is used in printing times, and more reliable
    than using \code{"\%Z"}.}

\item{...}{further arguments to be passed to or from other methods.}
}
\description{
The class \code{git_time} stores the time a Git object was created.
}
\details{
The default is to use \code{tz = "GMT"} and \code{origin =
"1970-01-01"}. To use your local timezone, set \code{tz =
Sys.timezone()}.
}
\examples{
\dontrun{
## Initialize a temporary repository
path <- tempfile(pattern="git2r-")
dir.create(path)
repo <- init(path)

## Create a first user and commit a file
config(repo, user.name = "Alice", user.email = "alice@example.org")
writeLines("Hello world!", file.path(path, "example.txt"))
add(repo, "example.txt")
commit(repo, "First commit message")

## Create tag
tag(repo, "Tagname", "Tag message")

as.POSIXct(commits(repo)[[1]]$author$when)
as.POSIXct(tags(repo)[[1]]$tagger$when)
as.POSIXct(tags(repo)[[1]]$tagger$when, tz = Sys.timezone())
}
}
\seealso{
\code{\link{when}}
}