1context("Updating dates")
2
3test_that("update.Date returns a date object", {
4  date <- as.Date("05/05/2010", "%m/%d/%Y")
5  expect_is(update(date, days = 1), "Date")
6  expect_is(update(date, ydays = 1), "Date")
7  expect_is(update(date, mdays = 1), "Date")
8  expect_is(update(date, wdays = 1), "Date")
9  expect_is(update(date, months = 1), "Date")
10  expect_is(update(date, years = 2001), "Date")
11  expect_is(update(date, tzs = "UTC"), "Date")
12})
13
14test_that("update.Date returns a posix object if time is manipulated", {
15  date <- as.Date("05/05/2010", "%m/%d/%Y")
16  expect_is(update(date, seconds = 1), "POSIXt")
17  expect_is(update(date, minutes = 1), "POSIXt")
18  expect_is(update(date, hours = 1), "POSIXt")
19})
20
21test_that("update.POSIXlt returns a POSIXlt object", {
22  poslt <- as.POSIXlt("2010-02-03 13:45:59", tz = "GMT", format = "%Y-%m-%d %H:%M:%S")
23  expect_is(update(poslt, seconds = 1), "POSIXlt")
24  expect_is(update(poslt, minutes = 1), "POSIXlt")
25  expect_is(update(poslt, hours = 1), "POSIXlt")
26  expect_is(update(poslt, days = 1), "POSIXlt")
27  expect_is(update(poslt, ydays = 1), "POSIXlt")
28  expect_is(update(poslt, mdays = 1), "POSIXlt")
29  expect_is(update(poslt, wdays = 1), "POSIXlt")
30  expect_is(update(poslt, months = 1), "POSIXlt")
31  expect_is(update(poslt, years = 2001), "POSIXlt")
32  expect_is(update(poslt, tzs = "UTC"), "POSIXlt")
33})
34
35test_that("update.POSIXct returns a POSIXct object", {
36  posct <- as.POSIXct("2010-02-03 13:45:59", tz = "GMT", format
37     = "%Y-%m-%d %H:%M:%S")
38  expect_is(update(posct, seconds = 1), "POSIXct")
39  expect_is(update(posct, minutes = 1), "POSIXct")
40  expect_is(update(posct, hours = 1), "POSIXct")
41  expect_is(update(posct, days = 1), "POSIXct")
42  expect_is(update(posct, ydays = 1), "POSIXct")
43  expect_is(update(posct, mdays = 1), "POSIXct")
44  expect_is(update(posct, wdays = 1), "POSIXct")
45  expect_is(update(posct, months = 1), "POSIXct")
46  expect_is(update(posct, years = 2001), "POSIXct")
47  expect_is(update(posct, tzs = "UTC"), "POSIXct")
48})
49
50test_that("update.Date performs simple operation as expected", {
51  date <- as.Date("05/05/2010", "%m/%d/%Y")
52  expect_equal(second(update(date, seconds = 1)), 1)
53  expect_equal(minute(update(date, minutes = 1)), 1)
54  expect_equal(hour(update(date, hours = 1)), 1)
55  expect_equal(mday(update(date, mdays = 1)), 1)
56  expect_equal(wday(update(date, mdays = 1)), 7)
57  expect_equal(yday(update(date, mdays = 1)), 121)
58  expect_equal(yday(update(date, ydays = 1)), 1)
59  expect_equal(mday(update(date, ydays = 1)), 1)
60  expect_equal(wday(update(date, ydays = 1)), 6)
61  expect_equal(wday(update(date, wdays = 1)), 1)
62  expect_equal(yday(update(date, wdays = 1)), 122)
63  expect_equal(mday(update(date, wdays = 1)), 2)
64  expect_equal(month(update(date, months = 1)), 1)
65  expect_equal(year(update(date, years = 2000)), 2000)
66  expect_match(tz(update(date, tzs = "UTC")), "UTC")
67})
68
69test_that("update.POSIXt performs simple operation as expected", {
70  poslt <- as.POSIXlt("2010-02-03 13:45:59", tz = "GMT", format = "%Y-%m-%d %H:%M:%S")
71  posct <- as.POSIXct("2010-02-03 13:45:59", tz = "GMT", format = "%Y-%m-%d %H:%M:%S")
72  expect_equal(second(update(poslt, seconds = 1)), 1)
73  expect_equal(minute(update(poslt, minutes = 1)), 1)
74  expect_equal(hour(update(poslt, hours = 1)), 1)
75  expect_equal(mday(update(poslt, mdays = 1)), 1)
76  expect_equal(wday(update(poslt, mdays = 1)), 2)
77  expect_equal(yday(update(poslt, mdays = 1)), 32)
78  expect_equal(yday(update(poslt, ydays = 1)), 1)
79  expect_equal(mday(update(poslt, ydays = 1)), 1)
80  expect_equal(wday(update(poslt, ydays = 1)), 6)
81  expect_equal(wday(update(poslt, wdays = 1)), 1)
82  expect_equal(yday(update(poslt, wdays = 1)), 31)
83  expect_equal(mday(update(poslt, wdays = 1)), 31)
84  expect_equal(month(update(poslt, months = 1)), 1)
85  expect_equal(year(update(poslt, years = 2000)), 2000)
86  expect_match(tz(update(poslt, tzs = "UTC")), "UTC")
87  expect_equal(second(update(posct, seconds = 1)), 1)
88  expect_equal(minute(update(posct, minutes = 1)), 1)
89  expect_equal(hour(update(posct, hours = 1)), 1)
90  expect_equal(mday(update(posct, mdays = 1)), 1)
91  expect_equal(wday(update(posct, mdays = 1)), 2)
92  expect_equal(yday(update(posct, mdays = 1)), 32)
93  expect_equal(yday(update(posct, ydays = 1)), 1)
94  expect_equal(mday(update(posct, ydays = 1)), 1)
95  expect_equal(wday(update(posct, ydays = 1)), 6)
96  expect_equal(wday(update(posct, wdays = 1)), 1)
97  expect_equal(yday(update(posct, wdays = 1)), 31)
98  expect_equal(mday(update(posct, wdays = 1)), 31)
99  expect_equal(month(update(posct, months = 1)), 1)
100  expect_equal(year(update(posct, years = 2000)), 2000)
101  expect_match(tz(update(posct, tzs = "UTC")), "UTC")
102})
103
104test_that("update.POSIXt works on wdays", {
105
106  date <- ymd("2017-05-07") ## sunday
107  ct <- as.POSIXct("2010-02-03 13:45:59", tz = "America/New_York", format = "%Y-%m-%d %H:%M:%S") ## Wednesday
108  expect_equal(wday(update(ct, wdays = 1)), 1)
109  expect_equal(wday(update(ct, wdays = 2)), 2)
110  expect_equal(wday(update(ct, wdays = 5)), 5)
111  expect_equal(wday(update(ct, wdays = 7)), 7)
112  expect_equal(wday(update(date, wdays = 1)), 1)
113  expect_equal(wday(update(date, wdays = 2)), 2)
114  expect_equal(wday(update(date, wdays = 5)), 5)
115  expect_equal(wday(update(date, wdays = 7)), 7)
116
117  ws <- 1
118  expect_equal(wday(update(ct, wdays = 1, week_start = ws)), 2)
119  expect_equal(wday(update(ct, wdays = 2, week_start = ws)), 3)
120  expect_equal(wday(update(ct, wdays = 5, week_start = ws)), 6)
121  expect_equal(wday(update(ct, wdays = 7, week_start = ws)), 1)
122  expect_equal(wday(update(date, wdays = 1, week_start = ws)), 2)
123  expect_equal(wday(update(date, wdays = 2, week_start = ws)), 3)
124  expect_equal(wday(update(date, wdays = 5, week_start = ws)), 6)
125  expect_equal(wday(update(date, wdays = 7, week_start = ws)), 1)
126
127  ws <- 1
128  expect_equal(wday(update(ct, wdays = 1, week_start = ws), week_start = ws), 1)
129  expect_equal(wday(update(ct, wdays = 2, week_start = ws), week_start = ws), 2)
130  expect_equal(wday(update(ct, wdays = 5, week_start = ws), week_start = ws), 5)
131  expect_equal(wday(update(ct, wdays = 7, week_start = ws), week_start = ws), 7)
132  expect_equal(wday(update(date, wdays = 1, week_start = ws), week_start = ws), 1)
133  expect_equal(wday(update(date, wdays = 2, week_start = ws), week_start = ws), 2)
134  expect_equal(wday(update(date, wdays = 5, week_start = ws), week_start = ws), 5)
135  expect_equal(wday(update(date, wdays = 7, week_start = ws), week_start = ws), 7)
136
137  ws <- 3
138  expect_equal(wday(update(ct, wdays = 1, week_start = ws), week_start = ws), 1)
139  expect_equal(wday(update(ct, wdays = 2, week_start = ws), week_start = ws), 2)
140  expect_equal(wday(update(ct, wdays = 5, week_start = ws), week_start = ws), 5)
141  expect_equal(wday(update(ct, wdays = 7, week_start = ws), week_start = ws), 7)
142  expect_equal(wday(update(date, wdays = 1, week_start = ws), week_start = ws), 1)
143  expect_equal(wday(update(date, wdays = 2, week_start = ws), week_start = ws), 2)
144  expect_equal(wday(update(date, wdays = 5, week_start = ws), week_start = ws), 5)
145  expect_equal(wday(update(date, wdays = 7, week_start = ws), week_start = ws), 7)
146
147})
148
149test_that("updates on ydays works correctly with leap years", {
150  expect_equal(update(ymd("15-02-03", tz = "UTC"), years = 2000, ydays = 1),
151               ymd("2000-01-01", tz = "UTC"))
152  expect_equal(update(ymd("15-02-03", tz = "UTC"), years = 2015, ydays = 1),
153               ymd("2015-01-01", tz = "UTC"))
154  expect_equal(update(ymd("15-02-03", tz = "UTC"), years = 2016, ydays = 10),
155               ymd("2016-01-10", tz = "UTC"))
156  expect_equal(update(ymd("15-02-03", tz = "America/New_York"), years = 2000, ydays = 1),
157               ymd("2000-01-01", tz = "America/New_York"))
158  expect_equal(update(ymd("15-02-03", tz = "America/New_York"), years = 2015, ydays = 1),
159               ymd("2015-01-01", tz = "America/New_York"))
160  expect_equal(update(ymd("15-02-03", tz = "America/New_York"), years = 2016, ydays = 10),
161               ymd("2016-01-10", tz = "America/New_York"))
162
163  expect_equal(update(ymd(c("2016-02-29", "2016-03-01")), ydays = 1),
164               ymd(c("2016-01-01", "2016-01-01")))
165  expect_equal(update(ymd(c("2016-02-29", "2016-03-01"), tz = "America/New_York"), ydays = 1),
166               ymd(c("2016-01-01", "2016-01-01"), tz = "America/New_York"))
167  expect_equal(update(ymd_hms(c("2016-02-29 1:2:3", "2016-03-01 10:20:30")), ydays = 1),
168               ymd_hms(c("2016-01-01 1:2:3", "2016-01-01 10:20:30")))
169  expect_equal(update(ymd_hms(c("2016-02-29 1:2:3", "2016-03-01 10:20:30"), tz = "America/New_York"), ydays = 1),
170               ymd_hms(c("2016-01-01 1:2:3", "2016-01-01 10:20:30"), tz = "America/New_York"))
171
172})
173
174
175test_that("update performs roll overs correctly for Date objects", {
176  date <- as.Date("05/05/2010", "%m/%d/%Y")
177  expect_equal(second(update(date, seconds = 61)), 1)
178  expect_equal(minute(update(date, seconds = 61)), 1)
179  expect_equal(minute(update(date, minutes = 61)), 1)
180  expect_equal(hour(update(date, minutes = 61)), 1)
181  expect_equal(hour(update(date, hours = 25)), 1)
182  expect_equal(mday(update(date, hours = 25)), 6)
183  expect_equal(yday(update(date, hours = 25)), 126)
184  expect_equal(wday(update(date, hours = 25)), 5)
185  expect_equal(mday(update(date, mdays = 32)), 1)
186  expect_equal(month(update(date, mdays = 32)), 6)
187  expect_equal(wday(update(date, wdays = 31)), 3)
188  expect_equal(month(update(date, wdays = 31)), 6)
189  expect_equal(yday(update(date, ydays = 366)), 1)
190  expect_equal(month(update(date, ydays = 366)), 1)
191  expect_equal(month(update(date, months = 13)), 1)
192  expect_equal(year(update(date, months = 13)), 2011)
193  expect_match(tz(update(date, months = 13)), "UTC")
194})
195
196test_that("update performs roll overs correctly for POSIXlt objects", {
197  poslt <- as.POSIXlt("2010-05-05 00:00:00", tz = "GMT", format = "%Y-%m-%d %H:%M:%S")
198  expect_equal(second(update(poslt, seconds = 61)), 1)
199  expect_equal(minute(update(poslt, seconds = 61)), 1)
200  expect_equal(minute(update(poslt, minutes = 61)), 1)
201  expect_equal(hour(update(poslt, minutes = 61)), 1)
202  expect_equal(hour(update(poslt, hours = 25)), 1)
203  expect_equal(mday(update(poslt, hours = 25)), 6)
204  expect_equal(yday(update(poslt, hours = 25)), 126)
205  expect_equal(wday(update(poslt, hours = 25)), 5)
206  expect_equal(mday(update(poslt, mdays = 32)), 1)
207  expect_equal(month(update(poslt, mdays = 32)), 6)
208  expect_equal(wday(update(poslt, wdays = 31)), 3)
209  expect_equal(month(update(poslt, wdays = 31)), 6)
210  expect_equal(yday(update(poslt, ydays = 366)), 1)
211  expect_equal(month(update(poslt, ydays = 366)), 1)
212  expect_equal(month(update(poslt, months = 13)), 1)
213  expect_equal(year(update(poslt, months = 13)), 2011)
214  expect_match(tz(update(poslt, months = 13)), "GMT")
215})
216
217test_that("update performs roll overs correctly for POSIXct objects", {
218  posct <- as.POSIXct("2010-05-05 00:00:00", tz = "GMT", format = "%Y-%m-%d %H:%M:%S")
219  expect_equal(second(update(posct, seconds = 61)), 1)
220  expect_equal(minute(update(posct, seconds = 61)), 1)
221  expect_equal(minute(update(posct, minutes = 61)), 1)
222  expect_equal(hour(update(posct, minutes = 61)), 1)
223  expect_equal(hour(update(posct, hours = 25)), 1)
224  expect_equal(mday(update(posct, hours = 25)), 6)
225  expect_equal(yday(update(posct, hours = 25)), 126)
226  expect_equal(wday(update(posct, hours = 25)), 5)
227  expect_equal(mday(update(posct, mdays = 32)), 1)
228  expect_equal(month(update(posct, mdays = 32)), 6)
229  expect_equal(wday(update(posct, wdays = 31)), 3)
230  expect_equal(month(update(posct, wdays = 31)), 6)
231  expect_equal(yday(update(posct, ydays = 366)), 1)
232  expect_equal(month(update(posct, ydays = 366)), 1)
233  expect_equal(month(update(posct, months = 13)), 1)
234  expect_equal(year(update(posct, months = 13)), 2011)
235  expect_match(tz(update(posct, months = 13)), "GMT")
236})
237
238test_that("update performs consecutive roll overs correctly for
239  Date objects regardless of order", {
240  date <- update(as.Date("11/01/2010", "%m/%d/%Y"),
241    months = 13, days = 32, hours = 25, minutes = 61, seconds
242     = 61)
243  expect_equal(second(date), 1)
244  expect_equal(minute(date), 2)
245  expect_equal(hour(date), 2)
246  expect_equal(mday(date), 2)
247  expect_equal(wday(date), 4)
248  expect_equal(yday(date), 33)
249  expect_equal(month(date), 2)
250  expect_equal(year(date), 2011)
251  expect_match(tz(date), "UTC")
252  date2 <- update(as.Date("11/01/2010", "%m/%d/%Y"),
253    seconds = 61, minutes = 61, hours = 25, days = 32, months = 13)
254  expect_equal(second(date2), 1)
255  expect_equal(minute(date2), 2)
256  expect_equal(hour(date2), 2)
257  expect_equal(mday(date2), 2)
258  expect_equal(wday(date2), 4)
259  expect_equal(yday(date2), 33)
260  expect_equal(month(date2), 2)
261  expect_equal(year(date2), 2011)
262  expect_match(tz(date2), "UTC")
263})
264
265test_that("update performs consecutive roll overs correctly for
266  POSIXlt objects", {
267  posl <- as.POSIXlt("2010-11-01 00:00:00", tz = "GMT", format
268     = "%Y-%m-%d %H:%M:%S")
269  poslt <- update(posl, months = 13, days = 32, hours = 25,
270    minutes = 61, seconds = 61)
271
272  expect_equal(second(poslt), 1)
273  expect_equal(minute(poslt), 2)
274  expect_equal(hour(poslt), 2)
275  expect_equal(mday(poslt), 2)
276  expect_equal(wday(poslt), 4)
277  expect_equal(yday(poslt), 33)
278  expect_equal(month(poslt), 2)
279  expect_equal(year(poslt), 2011)
280  expect_match(tz(poslt), "GMT")
281
282  poslt2 <- update(posl, seconds = 61, minutes = 61, hours = 25,
283    days = 32, months = 13)
284
285  expect_equal(second(poslt2), 1)
286  expect_equal(minute(poslt2), 2)
287  expect_equal(hour(poslt2), 2)
288  expect_equal(mday(poslt2), 2)
289  expect_equal(wday(poslt2), 4)
290  expect_equal(yday(poslt2), 33)
291  expect_equal(month(poslt2), 2)
292  expect_equal(year(poslt2), 2011)
293  expect_match(tz(poslt2), "GMT")
294})
295
296test_that("update performs consecutive roll overs correctly for POSIXct objects", {
297  posc <- as.POSIXct("2010-11-01 00:00:00", tz = "GMT", format
298     = "%Y-%m-%d %H:%M:%S")
299  posct <- update(posc, months = 13, days = 32, hours = 25,
300    minutes = 61, seconds = 61)
301
302  expect_equal(second(posct), 1)
303  expect_equal(minute(posct), 2)
304  expect_equal(hour(posct), 2)
305  expect_equal(mday(posct), 2)
306  expect_equal(wday(posct), 4)
307  expect_equal(yday(posct), 33)
308  expect_equal(month(posct), 2)
309  expect_equal(year(posct), 2011)
310  expect_match(tz(posct), "GMT")
311
312  posct2 <- update(posc, seconds = 61, minutes = 61, hours = 25,
313    days = 32, months = 13)
314
315  expect_equal(second(posct2), 1)
316  expect_equal(minute(posct2), 2)
317  expect_equal(hour(posct2), 2)
318  expect_equal(mday(posct2), 2)
319  expect_equal(wday(posct2), 4)
320  expect_equal(yday(posct2), 33)
321  expect_equal(month(posct2), 2)
322  expect_equal(year(posct2), 2011)
323  expect_match(tz(posct2), "GMT")
324})
325
326test_that("update returns NA for date-times in the spring dst gap", {
327  poslt <- as.POSIXlt("2010-03-14 01:59:59", tz = "UTC", format = "%Y-%m-%d %H:%M:%S")
328  poslt <- force_tz(poslt, tzone = "America/New_York")
329  expect_true(is.na(update(poslt, seconds = 65)))
330  expect_true(is.na(update(poslt, minutes = 65)))
331  expect_true(is.na(update(poslt, hours = 2)))
332  poslt <- as.POSIXlt("2010-03-13 02:59:59", tz = "UTC", format = "%Y-%m-%d %H:%M:%S")
333  poslt <- force_tz(poslt, tzone = "America/New_York")
334  expect_true(is.na(update(poslt, mdays = 14)))
335  expect_true(is.na(update(poslt, wdays = 8)))
336  expect_true(is.na(update(poslt, ydays = 73)))
337  poslt <- as.POSIXlt("2010-02-14 02:59:59", tz = "UTC", format = "%Y-%m-%d %H:%M:%S")
338  poslt <- force_tz(poslt, tzone = "America/New_York")
339  expect_true(is.na(update(poslt, months = 3)))
340  poslt <- as.POSIXlt("2009-03-14 02:59:59", tz = "UTC", format = "%Y-%m-%d %H:%M:%S")
341  poslt <- force_tz(poslt, tzone = "America/New_York")
342  expect_true(is.na(update(poslt, years = 2010)))
343  poslt <- as.POSIXlt("2010-03-14 02:59:59", tz = "UTC", format = "%Y-%m-%d %H:%M:%S")
344  expect_true(is.na(update(poslt, tzs = "America/New_York")))
345})
346
347test_that("update handles vectors of dates", {
348  poslt <- as.POSIXlt(c("2010-02-14 01:59:59", "2010-02-15 01:59:59", "2010-02-16 01:59:59"),
349                      tz = "UTC", format = "%Y-%m-%d %H:%M:%S")
350  posct <- as.POSIXct(poslt)
351  date <- as.Date(poslt)
352  expect_equal(second(update(poslt, seconds = 1)), c(1, 1, 1))
353  expect_equal(second(update(posct, seconds = 1)), c(1, 1, 1))
354  expect_equal(day(update(date, days = 1)), c(1, 1, 1))
355})
356
357test_that("update handles vectors of dates and conformable vector of inputs", {
358  poslt <- as.POSIXlt(c("2010-02-14 01:59:59", "2010-02-15 01:59:59", "2010-02-16
359    01:59:59"), tz = "UTC", format = "%Y-%m-%d %H:%M:%S")
360  posct <- as.POSIXct(poslt)
361  date <- as.Date(poslt)
362  expect_equal(second(update(poslt, seconds = c(1, 2, 3))), c(1, 2, 3))
363  expect_equal(second(update(posct, seconds = c(1, 2, 3))), c(1, 2, 3))
364  expect_equal(day(update(date, days = c(1, 2, 3))), c(1, 2, 3))
365})
366
367test_that("update handles single vector of inputs", {
368  poslt <- as.POSIXlt("2010-03-14 01:59:59", tz = "UTC", format = "%Y-%m-%d %H:%M:%S")
369  posct <- as.POSIXct(poslt)
370  date <- as.Date(poslt)
371  expect_equal(second(update(poslt, seconds = c(1, 2, 3))), c(1, 2, 3))
372  expect_equal(second(update(posct, seconds = c(1, 2, 3))), c(1, 2, 3))
373  expect_equal(day(update(date, days = c(1, 2, 3))), c(1, 2, 3))
374})
375
376test_that("update handles conformable vectors of inputs", {
377  poslt <- as.POSIXlt("2010-03-10 01:59:59", tz = "UTC", format = "%Y-%m-%d %H:%M:%S")
378  posct <- as.POSIXct(poslt)
379  date <- as.Date(poslt)
380  expect_equal(second(update(poslt, seconds = c(1, 2), minutes = c(1, 2, 3, 4))), c(1, 2, 1, 2))
381  expect_equal(second(update(posct, seconds = c(1, 2), minutes = c(1, 2, 3, 4))), c(1, 2, 1, 2))
382  expect_equal(day(update(date, days = c(1, 2), months = c(1, 2, 3, 4))), c(1, 2, 1, 2))
383})
384
385test_that("update.POSIXct returns input of length zero when given input of length zero", {
386  x <- structure(vector(mode = "numeric"), class = c("POSIXct", "POSIXt"))
387  expect_equal(update(x, days = 1), x)
388})
389
390test_that("update.POSIXlt returns input of length zero when given input of length zero", {
391  x <- as.POSIXlt(structure(vector(mode = "numeric"), class = c("POSIXct", "POSIXt")))
392  expect_equal(update(x, days = 1), x)
393})
394
395test_that("update correctly handles 60 seconds on 59 minute (bug #313)", {
396  expect_equal(ymd_hms("2015-01-01 00:59:00") + seconds(60),
397               ymd_hms("2015-01-01 01:00:00"))
398  expect_equal(ymd_hms("2015-01-01 01:59:00") + seconds(60),
399               ymd_hms("2015-01-01 02:00:00"))
400  expect_equal(ymd_hms("2015-01-01 23:59:00") + seconds(60),
401               ymd_hms("2015-01-02 00:00:00"))
402  expect_equal(ymd_hms("2015-01-01 00:59:05") + seconds(55),
403               ymd_hms("2015-01-01 01:00:00"))
404  expect_equal(ymd_hms("2015-01-01 00:59:59") + seconds(1),
405               ymd_hms("2015-01-01 01:00:00"))
406})
407
408test_that("Updateing on seconds doesn't affect hours", {
409  ## https://github.com/tidyverse/lubridate/issues/619
410
411  tt2 <- tt <- Sys.time()
412  second(tt2) <- 5
413  expect_equal(hour(tt), hour(tt2))
414})
415
416
417## ## bug #319
418## x <- structure(list(sec = 0, min = 0, hour = 0, mday = -212, mon = 7L,
419##                         year = 108L, wday = NA_integer_, yday = NA_integer_, isdst = 0L,
420##                         zone = "EST", gmtoff = -18000L),
421##                    .Names = c("sec", "min",
422##                        "hour", "mday", "mon", "year", "wday", "yday", "isdst", "zone",
423##                        "gmtoff"),
424##                    tzone = c("America/New_York", "EST", "EDT"),
425##                    class = c("POSIXlt", "POSIXt"))
426## update(x, year = year(x) + 1)
427