From 2fd71c54fa12d15d0e92d8f233f587257f74c8ae Mon Sep 17 00:00:00 2001 From: David Gilbank <51793450+dgilbank@users.noreply.github.com> Date: Tue, 25 Jun 2019 01:15:15 -0400 Subject: [PATCH] Created method for returning raw system time. (#57) * Created method for returning raw system time. Human-readable time is now a separate method (but still the default for GetPLCTime()) and uses this new method. * Added missing "self" * Added back lines accidentally deleted. Refactored to remove separate GetRawPLCTime() routine - now GetPLCTime() is still a single method but with keyword raw=False (default). --- pylogix/eip.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pylogix/eip.py b/pylogix/eip.py index c5ad911..18a377d 100644 --- a/pylogix/eip.py +++ b/pylogix/eip.py @@ -105,11 +105,11 @@ def MultiRead(self, tags): ''' return _multiRead(self, tags) - def GetPLCTime(self): + def GetPLCTime(self, raw=False): ''' - Get the PLC's clock time + Get the PLC's clock time, return as human readable (default) or raw if raw=True ''' - return _getPLCTime(self) + return _getPLCTime(self, raw) def SetPLCTime(self): ''' @@ -348,7 +348,7 @@ def _multiRead(self, tags): err = 'Unknown error {}'.format(status) raise ValueError('Multi-read failed: {}'.format(err)) -def _getPLCTime(self): +def _getPLCTime(self, raw=False): ''' Requests the PLC clock time ''' @@ -379,6 +379,8 @@ def _getPLCTime(self): if status == 0: # get the time from the packet plcTime = unpack_from('