| Line 98... |
Line 98... |
| 98 |
a character vector of length 3 giving the timezone name from the
|
98 |
a character vector of length 3 giving the timezone name from the
|
| 99 |
\env{TZ} environment variable and the names of the base timezone
|
99 |
\env{TZ} environment variable and the names of the base timezone
|
| 100 |
and the alternate (daylight-saving) timezone. Sometimes this may
|
100 |
and the alternate (daylight-saving) timezone. Sometimes this may
|
| 101 |
just be of length one, giving the timezone name.
|
101 |
just be of length one, giving the timezone name.
|
| 102 |
|
102 |
|
| - |
|
103 |
\code{"POSIXct"} objects may also have an attribute \code{"tzone"}, a
|
| - |
|
104 |
character vector of length one. If set, it will determine how the
|
| - |
|
105 |
object is converted to class \code{"POSIXlt"} and in particular how it
|
| - |
|
106 |
is printed. This is usually desirable, but if you want to specify an
|
| - |
|
107 |
object in a particular timezone but to be printed in the current
|
| - |
|
108 |
timezone you may want to remove the \code{"tzone"} attribute (e.g. by
|
| - |
|
109 |
\code{c(x)}).
|
| - |
|
110 |
|
| 103 |
Unfortunately, the conversion is complicated by the operation of time
|
111 |
Unfortunately, the conversion is complicated by the operation of time
|
| 104 |
zones and leap seconds (22 days have been 86401 seconds long so far:
|
112 |
zones and leap seconds (22 days have been 86401 seconds long so far:
|
| 105 |
the times of the extra seconds are in the object \code{.leap.seconds}).
|
113 |
the times of the extra seconds are in the object \code{.leap.seconds}).
|
| 106 |
The details of this are entrusted to the OS services where possible.
|
114 |
The details of this are entrusted to the OS services where possible.
|
| 107 |
This will usually cover the period 1970--2037, and on Unix machines
|
115 |
This will usually cover the period 1970--2037, and on Unix machines
|
| Line 116... |
Line 124... |
| 116 |
be wrong if the system has changed since build time, just possibly by
|
124 |
be wrong if the system has changed since build time, just possibly by
|
| 117 |
changing locales.)
|
125 |
changing locales.)
|
| 118 |
|
126 |
|
| 119 |
Using \code{\link{c}} on \code{"POSIXlt"} objects converts them to the
|
127 |
Using \code{\link{c}} on \code{"POSIXlt"} objects converts them to the
|
| 120 |
current time zone.
|
128 |
current time zone.
|
| 121 |
|
- |
|
| 122 |
}
|
129 |
}
|
| 123 |
\seealso{
|
130 |
\seealso{
|
| 124 |
\code{\link{as.POSIXct}} and \code{\link{as.POSIXlt}} for conversion
|
131 |
\code{\link{as.POSIXct}} and \code{\link{as.POSIXlt}} for conversion
|
| 125 |
between the classes.
|
132 |
between the classes.
|
| 126 |
|
133 |
|
| Line 148... |
Line 155... |
| 148 |
|
155 |
|
| 149 |
Sys.time() - 3600 # an hour ago
|
156 |
Sys.time() - 3600 # an hour ago
|
| 150 |
|
157 |
|
| 151 |
as.POSIXlt(Sys.time(), "GMT") # the current time in GMT
|
158 |
as.POSIXlt(Sys.time(), "GMT") # the current time in GMT
|
| 152 |
format(.leap.seconds) # all 22 leapseconds in your timezone
|
159 |
format(.leap.seconds) # all 22 leapseconds in your timezone
|
| - |
|
160 |
print(.leap.seconds, tz="PST8PDT") # and in Seattle's
|
| 153 |
}
|
161 |
}
|
| 154 |
\keyword{utilities}
|
162 |
\keyword{utilities}
|
| 155 |
\keyword{chron}
|
163 |
\keyword{chron}
|