Pygame watch - how long can it work?

I use Python and pygame for the task of control and automation. Information from the sensor is displayed using pygame, then written to another location.
To limit the frame rate, I use the pygame clock mark.

Since this is an embedded application, the process can run for several months. Will the pygame clock stop working, i.e. If he saves ms as an integer (long integer) when he runs out of time, and can he handle the return to 0 (or, worse, minus)?

If time runs out, how long will it work? I think I remember that the first version of Win95 crashed after 4 days for this reason!

I am using usisg Python2.7 on Raspberry Pi ver 3, if relevant.

+5
source share
1 answer

Python 2.7.x has two integer types: "prime integers" and "long integers." The first ones are basically long int in C, which should be at least 32 bits. The latter are not limited. Since the calculations are automatically converted to long, if necessary, 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'> 
+2
source

Source: https://habr.com/ru/post/1262691/


All Articles