Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor correction of timestamp handling code in readGENEActiv #55

Merged
merged 1 commit into from
Jan 23, 2024

Conversation

l-k-
Copy link
Collaborator

@l-k- l-k- commented Jan 20, 2024

I was looking at timestamp handling in GGIR, so looked at GGIRread as well, and saw this minor issue. It doesn't really affect anything besides understandability of the code, but I thought I'd send a small PR anyway.

Basically I removed an unnecessary operation.

starttime_posix object later gets converted with as.numeric(), which produces a Unix timestamp, which is always in UTC. So converting starttime_posix from configtz timezone to desiredtz doesn't achieve anything. The only thing that matters is that we use the correct timezone when converting from the original string representation to the POSIX object.

This extra operation wasn't breaking anything, but I think it's better to remove it so that there isn't any illusion from reading the code that the returned timestamps are somehow in desiredtz. They are unix timestamps, in UTC.

starttime_posix later gets converted with as.numeric(), which produces a Unix timestamp, which is always in UTC.  So converting starttime_posix from configtz timezone to desiredtz doesn't achieve anything. The only thing that matters is that we use the correct timezone when converting from the original string representation to the POSIX object.

This extra operation wasn't breaking anything, but I think it's better to remove it so that there isn't any illusion from reading the code that the returned timestamps are somehow in desiredtz. They are unix timestamps, in UTC.
Copy link

codecov bot commented Jan 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (ca5a879) 90.03% compared to head (5a791ea) 90.01%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #55      +/-   ##
==========================================
- Coverage   90.03%   90.01%   -0.03%     
==========================================
  Files           9        9              
  Lines         903      901       -2     
==========================================
- Hits          813      811       -2     
  Misses         90       90              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@l-k-
Copy link
Collaborator Author

l-k- commented Jan 20, 2024

@vincentvanhees I was also wondering if you remember what + 5 is for on this line? I was curious and I couldn't figure it out.

@vincentvanhees
Copy link
Member

@vincentvanhees I was also wondering if you remember what + 5 is for on this line? I was curious and I couldn't figure it out.

I did that to make the output empirically consistent with the R package GENEAread, which is slower but was developed by the manufacturer. Somehow my timestamps were always 5 off relative to their output. I could not figure out why.

@vincentvanhees vincentvanhees merged commit 9c4aea2 into main Jan 23, 2024
10 checks passed
@l-k- l-k- deleted the minor-correction-of-timestamp-handling branch January 24, 2024 16:09
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.

2 participants