Skip to content

Commit a53c4c5

Browse files
authored
Merge pull request #623 from RcppCore/bugfix/date_windows
two refinements for Date.cpp required on Windows
2 parents f0442a0 + 6410f43 commit a53c4c5

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

ChangeLog

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
2017-01-04 Dirk Eddelbuettel <[email protected]>
2+
3+
* src/Date.cpp (Rcpp): Protect assignment to tm_gmtoff to not being
4+
under MinGW; could potentially bite other too-limited systems
5+
6+
* inst/unitTests/runit.Date.R (test.Datetime.formating): Do not set TZ
7+
when running test, only set digits option
8+
19
2017-01-01 Dirk Eddelbuettel <[email protected]>
210

311
* inst/unitTests/runit.Date.R (test.mktime, test.gmtime): New tests

inst/unitTests/runit.Date.R

100644100755
Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,9 +217,6 @@ if (.runThisTest) {
217217
}
218218

219219
test.Datetime.formating <- function() {
220-
oldTZ <- Sys.getenv("TZ")
221-
Sys.setenv(TZ="America/Chicago")
222-
223220
olddigits <- getOption("digits.secs")
224221
options("digits.secs"=6)
225222

@@ -234,7 +231,6 @@ if (.runThisTest) {
234231
format(d, "%Y-%m-%d %H:%M:%OS"),
235232
msg="Datetime.formating.ostream")
236233

237-
Sys.setenv(TZ=oldTZ)
238234
options("digits.secs"=olddigits)
239235
}
240236

src/Date.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1347,9 +1347,10 @@ struct tzhead {
13471347
idays -= ip[tmp->tm_mon];
13481348
tmp->tm_mday = (int) (idays + 1);
13491349
tmp->tm_isdst = 0;
1350-
//#ifdef HAVE_TM_GMTOFF
1350+
#if ! (defined(__MINGW32__) || defined(__MINGW64__))
1351+
//#ifdef HAVE_TM_GMTOFF
13511352
tmp->tm_gmtoff = offset;
1352-
//#endif
1353+
#endif
13531354
return tmp;
13541355
}
13551356

0 commit comments

Comments
 (0)