Python syntax time functions in cas
|
09-07-2019, 08:10 PM
(This post was last modified: 09-08-2019 08:31 AM by StephenG1CMZ.)
Post: #4
|
|||
|
|||
RE: Python syntax time functions in cas
I assume that monotonic is not implemented.
There are four alternatives that could be used on the HP Prime if you allow PPL syntax within Python syntax. First, how important is it to you that the solution is always monotonic? For those unfamiliar with the term, it means that the solution is always positive (i.e. Unlike most Ticks implementations, which eventually wrap around from a large positive to a large negative). Is that a requirement of your solution, or just something in the original code? Put simply, will a simple Ticks suffice or do you need perfection? The PPL syntax available is: TEVAL(this-code): Monotonic. Time in seconds to execute this-code (a function or command). TiCKS() : Non-monotonic. Result in milliseconds. Time() : Monotonic (when used together with Date() ). Formatted HH:MMS result. time() : undocumented. Possibly seconds since switch-on - if so, monotonic. (Update: time() with no parameters seems to return a numbers of seconds, but time(this code) can also be used, like TEVAL) The easiest solution may be to use time(), but I have not found any documentation on it. An alternative solution is to use Ticks. This will work with the rest of the code unmodified if you can accept errors when Ticks wraps. You could add code to check whether stop is greater than start. TEVAL is monotonic but requires the code to be restructured. Expected syntax is TEVAL(this-code)/1_s So you would need to wrap that Wait() inside the TEVAL. The /1_s removes the units. Time() is monotonic if used in conjunction with Date() (or if you avoid working at midnight) but the results are formatted as HHMMSS so the subtraction would need some parsing.. Code: Apologies for lower case/upper case difficulties: My spell checker is powerful. Stephen Lewkowicz (G1CMZ) https://my.numworks.com/python/steveg1cmz |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
Python syntax time functions in cas - Stevetuc - 09-07-2019, 01:44 PM
RE: Python syntax time functions in cas - jebem - 09-07-2019, 06:48 PM
RE: Python syntax time functions in cas - Stevetuc - 09-07-2019, 07:32 PM
RE: Python syntax time functions in cas - StephenG1CMZ - 09-07-2019 08:10 PM
RE: Python syntax time functions in cas - Stevetuc - 09-08-2019, 06:57 AM
RE: Python syntax time functions in cas - parisse - 09-09-2019, 06:12 AM
RE: Python syntax time functions in cas - compsystems - 09-09-2019, 11:42 AM
|
User(s) browsing this thread: 1 Guest(s)