Answer the question
In order to leave comments, you need to log in
How to store dynamic data?
There is a certain number that is updated once a second, you need to store it for three days to display the graph. The average for the last minute is displayed and it is drawn to the chart. What is the best way to store such data? It is desirable that the data be loaded after restarting the program. Tell me how best to store such data when the new ones erase the old ones and data remains for a given amount of time. For now, I'll think about using an array for all seconds in three days and plotting on it.
Answer the question
In order to leave comments, you need to log in
Use time series Databases.
Or, to put it more simply, a database in which there is a timestamp -> value
And then build graphs for yourself.
https://calculators.vip/en/2posmotret-fayl-bolshog...
This can help you, it helped me
Write a number to the database, attach the date of receipt of this number
to the number Check numbers every second, if the current date differs from the one in the database, then delete it
Using the database is the only way to save variables after restarting the program
Look, make a file with the following structure
Datetime time of the last record
Duration int number of records in the file
Pointer int pointer to the ring buffer
Next are the float * duration records
In your case there should be 3* 8600
Once per second you open the file and update the datetime pointer and the record by index pointer . The pointer grows monotonically when it becomes equal to the size it jumps to 0 in the general ring buffer
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question