From 3baf2aa04b4cb64acef5f321e760c69fd874314a Mon Sep 17 00:00:00 2001 From: l-k- Date: Fri, 15 Dec 2023 17:34:26 +0000 Subject: [PATCH] return same timestamp format for all sensor types g.getstarttime() was returning timestamps in iso8601 format for Axivity .cwa and GENEActiv .bin files, but it was returning timestamps in POSIX format for all other input formats. The only caller of g.getstarttime() is get_starttime_weekday_meantemp_truncdata(), and it isn't handling iso8601 format correctly. So now g.getstarttime() will return POSIX timestamps for all sensor types. --- NEWS.md | 4 ++++ R/g.getstarttime.R | 2 -- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/NEWS.md b/NEWS.md index 5eae56338..c3aa0f2b8 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,7 @@ +# CHANGES IN GGIR VERSION 3.0-3 + +- Part 1: Fix bug where on machines with GMT timezone and R >= 4.3.0, for GENEActiv .bin files, the starting timestamps of M$metalong and M$metashort were truncated to midninght #1000 + # CHANGES IN GGIR VERSION 3.0-2 - Part 2: Fix bug that caused part 2 to struggle with corrupt ActiGraph .gt3x files #972 diff --git a/R/g.getstarttime.R b/R/g.getstarttime.R index b0834d952..f3149ab67 100644 --- a/R/g.getstarttime.R +++ b/R/g.getstarttime.R @@ -4,10 +4,8 @@ g.getstarttime = function(datafile, P, header, mon, dformat, desiredtz, configtz if (mon == MONITOR$AXIVITY && dformat == FORMAT$CWA) { starttime = P$data[1,1] starttime = as.POSIXlt(starttime, tz = desiredtz, origin = "1970-01-01") - starttime = POSIXtime2iso8601(starttime, tz = desiredtz) } else if (mon == MONITOR$GENEACTIV && dformat == FORMAT$BIN) { starttime = as.POSIXlt(P$data.out$time[1], tz = desiredtz, origin = "1970-01-01") - starttime = POSIXtime2iso8601(starttime, tz = desiredtz) } else if (dformat == FORMAT$CSV && (mon == MONITOR$ACTIGRAPH || mon == MONITOR$AXIVITY || mon == MONITOR$VERISENSE)) { if (mon == MONITOR$ACTIGRAPH || mon == MONITOR$VERISENSE) { tmph = read.csv(datafile, nrow = 8, skip = 1)