Part 2: fix activity log (qwindow) segments assigned one day early (#1518)#1523
Open
peterolejua wants to merge 1 commit into
Open
Part 2: fix activity log (qwindow) segments assigned one day early (#1518)#1523peterolejua wants to merge 1 commit into
peterolejua wants to merge 1 commit into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
as.Date(...), whichdefaults to
tz = "UTC"(the inneriso8601chartime2POSIX()gotdesiredtz, butthe outer
as.Date()did not);calendar_dateis 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_recordingand the qwindow match is shifted one day earlier for the whole recording.
This passes
desiredtzto the outeras.Date()so the recording-day dates use thesame 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_namesmatched the activity-logrow of the same date.
🤖 Generated with Claude Code