Skip to content

Part 2: fix activity log (qwindow) segments assigned one day early (#1518)#1523

Open
peterolejua wants to merge 1 commit into
wadpac:mainfrom
peterolejua:issue1518_actlog_date_tz
Open

Part 2: fix activity log (qwindow) segments assigned one day early (#1518)#1523
peterolejua wants to merge 1 commit into
wadpac:mainfrom
peterolejua:issue1518_actlog_date_tz

Conversation

@peterolejua

Copy link
Copy Markdown

Closes #1518.

When part 2 is guided by an activity log (qwindow = <file>), g.analyse.perday()
derives two dates for each recording day in inconsistent timezones:

  • the date used to match the activity log was computed with as.Date(...), which
    defaults to tz = "UTC" (the inner iso8601chartime2POSIX() got desiredtz, but
    the outer as.Date() did not);
  • calendar_date is taken from the local timestamp string (line ~232).

For recordings that start in the local evening at a negative UTC offset, the UTC date
rolls past midnight, so the first local date never appears in unique_dates_recording
and the qwindow match is shifted one day earlier for the whole recording.

This passes desiredtz to the outer as.Date() so the recording-day dates use the
same timezone as calendar_date.

Confirmed end-to-end on real Axivity AX3 data (devices started recording at 20:15
local EDT): with the unpatched code the activity-log segments were assigned to the
previous day, and with this change every day's qwindow_names matched the activity-log
row of the same date.

🤖 Generated with Claude Code

g.analyse.perday() derived the recording-day dates with as.Date(), which
defaults to tz = "UTC", while calendar_date is taken from the local timestamp
string. For recordings that start in the local evening at a negative UTC offset,
the UTC date rolls past midnight, dropping the first local date and shifting the
qwindow (activity log) match by one day. Pass desiredtz to as.Date() so the
recording-day dates use the same timezone as calendar_date.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Activity log (qwindow) segments assigned one day early: as.Date() defaults to UTC in g.analyse.perday

1 participant