Skip to content

Commit

Permalink
return same timestamp format for all sensor types
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
l-k- committed Dec 15, 2023
1 parent 4e33a63 commit 3baf2aa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 0 additions & 2 deletions R/g.getstarttime.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 3baf2aa

Please sign in to comment.