I use Python and pygame for a control and automation task. Information from a sensor is displayed using pygame then is recorded elsewhere.
To limit the framerate I am using the pygame clock tick.
As this is an embedded application the process could be running for months at a time. Will the pygame clock ever stop working i.e. if it stores the ms as an integer (long integer whatever) when will it run out of time and can it cope with going back round to 0 (or worse minus something)?
If it does run out how long will it work for? I seem to remember the first version of Win95 crashed after 4 days for this reason!
I'm usisg Python2.7 on a Raspberry Pi ver 3 if this is relevent.
Python 2.7.x has two integer types: "plain integers" and "long integers". The former are basically long int
s in C, which should be at least 32 bits. The latter are unlimited. Since calculations automatically convert into long if needed, you should be fine.
Example:
Python 2.7.10 (default, May 23 2015, 09:44:00) [MSC v.1500 64 bit (AMD64)] on win32
>>> x=1<<30
>>> x
1073741824
>>> type(x)
<type 'int'>
>>> x+=1<<30
>>> x
2147483648L
>>> type(x)
<type 'long'>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With