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

Timezone fix for get_plc_time #306

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jbolognini
Copy link

Fix for logix_driver get_plc_time method to use attribute x06 (UTC time) instead of x0B (local time) with added optional time zone parameter "tz" to convert returned time to a specific local time zone. Returns UTC if this param is omitted.

Clarification for set_plc_time method's microseconds param that it is relative to the UTC epoch (documentation only). The user now knows they are responsible to convert local time to UTC before calling the method if not omitting the param to use their system clock.

Changed get_plc_time() method to use attribute 6 for utc system time instead of 11 which was local system time. Added timezone parameter to choose timezone returned. Updated docstring.
Added clarification to set_plc_time microseconds param documentation that it is relative to UTC epoch
@jbolognini
Copy link
Author

I did test this code against a 1756-L71 processor and it worked. I did not take the time to write the test code with nice output proving the results. I understand if you do not approve this until the test code is posted. I can do that when I get some time. Also not sure that all processors that pycomm3 supports will support attribute x06, although i don't see why they wouldnt. I believe the much older logix processors only supported attribute x06 and support was added later for 0x0B but i could be wrong (digging into my memory). Any way the set_plc_time method uses attribute 0x06 so it should be as safe as that method.

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.

1 participant