Method for recording time cycle data, electronic equipment and computer readable storage medium

By employing a time-loop data storage method and a two-level index architecture, the problems of data loss and fragmentation during video stream reading and writing are solved, achieving efficient data retrieval and low-latency data indexing, which is suitable for video playback fields such as digital television.

CN120804041APending Publication Date: 2025-10-17SHENZHEN TONGJIU ELECTRONICS CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510899627.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-01
Publication Date
2025-10-17

AI Technical Summary

Technical Problem

In existing technologies, video stream data is easily lost during reading and writing, has a high degree of fragmentation, and has low file retrieval efficiency. In particular, timing metadata is lost when power is interrupted, and large file circular writing leads to severe file fragmentation. Reading specific data blocks requires global scanning, resulting in low efficiency.

Method used

A time-cycle data storage method is adopted. By initializing the maximum number of files, the capacity of a single file, and the total storage duration, timestamped data blocks are recorded. A two-level index architecture of files and data blocks is used to realize independent writing and positioning of data blocks. Data retrieval is optimized by combining a binary search algorithm.

Benefits of technology

It reduces data loss and fragmentation rates, improves data retrieval efficiency, reduces data indexing time complexity from O(n) to O(logN), ensures that only one data block is lost after a power outage, has a lower fragmentation rate, and significantly reduces retrieval latency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120804041A_ABST
    Figure CN120804041A_ABST
Patent Text Reader

Abstract

The invention discloses a method for recording time cycle data. The method comprises the following steps of S1, performing initialization; s2, when a data block with a timestamp is written in, detecting the residual space of the current file; s3, writing the data block into the current file when the residual space of the current file is sufficient, creating a new file when the residual space of the current file is insufficient, writing the data block into the new file, and updating a file ending timestamp after the data block is written; s4, when the number of the files reaches N, deleting the oldest file; and S5, continuously updating the total storage duration D. According to the method, writing of each data block is independent recording time, only part of data of one data block is lost after power failure, the data loss rate is lower, and generated fragments are fewer; meanwhile, through deletion of the whole file, compared with a traditional mode of coverage according to bytes, the generated fragment rate is lower; through the file-data block two-stage index architecture, the time complexity of data indexing is reduced, the data indexing delay is greatly reduced, and the data indexing efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of data processing, and in particular to a method for recording time cycle data, an electronic device and a computer readable storage medium. BACKGROUND

[0002] In the field of video playing such as digital television, sometimes it is needed to save live audio and video code stream according to time, and then to play corresponding data block according to saved time sequence. Since storage space is limited, after filling the limited storage space, it is needed to overwrite the data already written. At present, when reading and writing video code stream data, the data is usually stored in a ring buffer, but this storage method at least has the following problems: when power is interrupted, time sequence metadata is easily lost, resulting in a large amount of data loss; when a large file is written in a cycle, a large number of file fragments are generated due to byte-by-byte overwriting; when reading a specific data block, global scanning is needed, resulting in low file retrieval efficiency. SUMMARY

[0003] The present application provides a method for recording time cycle data, an electronic device and a computer readable storage medium, to solve the technical problems that at present video code stream data is easily lost when power is interrupted, has high fragmentation degree and low file retrieval efficiency when reading and writing.

[0004] To solve the above technical problems, in a first aspect, an embodiment of the present application provides a method for recording time cycle data, including a data storage method and a data retrieval method, the data storage method including the following steps:

[0005] S1: initializing maximum file number N, single file capacity S and total storage duration D;

[0006] S2: when writing a data block with a timestamp, detecting the remaining space of the current file;

[0007] S3: when the remaining space of the current file is sufficient, writing the data block into the current file, when the remaining space of the current file is insufficient, creating a new file and writing the data block into the new file, and updating the file end timestamp after writing the data block;

[0008] S4: when the file number reaches N, deleting the oldest file;

[0009] S5: continuously updating the total storage duration D = latest file end timestamp - oldest file start timestamp.

[0010] In combination with the first aspect, in a possible implementation manner, the step S3 specifically includes:

[0011] S31: when the capacity of the data block and the current file is less than or equal to the single file capacity S, writing the data block into the current file and updating the file end timestamp;

[0012] S32: When the data block is greater than the single file capacity S, a new file is created, the data block is written into the new file, and the file end timestamp is updated.

[0013] With reference to the first aspect, in a possible implementation manner, in the step S3, when the data block is written into the file, the position of the data block in the file is also recorded.

[0014] With reference to the first aspect, in a possible implementation manner, in the step S4, when the oldest file is deleted, the start timestamp of the file index matrix is also updated synchronously.

[0015] With reference to the first aspect, in a possible implementation manner, the precision of the timestamp is millisecond level.

[0016] With reference to the first aspect, in a possible implementation manner, the data retrieval method comprises the following steps:

[0017] S6: Obtain the start time t, and determine whether the time t is within the valid time range;

[0018] S7: Obtain the file F1 corresponding to the start time t;

[0019] S8: Read data from the first data block BlockA with a timestamp greater than or equal to the start time t.

[0020] With reference to the first aspect, in a possible implementation manner, the step S8 specifically comprises the following steps:

[0021] S81: Read the data block BlockA and its time Ta;

[0022] S82: Read the next data block BlockB, and obtain its time Tb;

[0023] S83: After waiting for (Tb-Ta) seconds, use the data block BlockB, set Ta=Tb, and return to the step S82 until the data reading is completed.

[0024] With reference to the first aspect, in a possible implementation manner, in the step S7, the file F1 corresponding to the start time t is obtained by using a binary search algorithm, and in the step S8, the first data block BlockA with a timestamp greater than or equal to the start time t is obtained by also using a binary search algorithm.

[0025] In a second aspect, the embodiments of the present application further provide an electronic device, comprising a memory and a processor, the memory being connected to the processor, the processor being configured to execute one or more computer programs stored in the memory, and the processor, when executing the one or more computer programs, causes the electronic device to implement the method according to the first aspect.

[0026] In a third aspect, the embodiments of the present application further provide a computer readable storage medium, which stores a computer program, the computer program comprising program instructions, and the program instructions, when executed by a processor, cause the processor to execute the method according to the first aspect.

[0027] The present application has the following beneficial effects: in the method for recording time cycle data according to the embodiments of the present application, the time is recorded independently when each data block is written, and only part of data of one data block will be lost after power failure, the data loss rate is lower, and the generated fragments are less; at the same time, compared with the traditional byte-overwriting method, the fragment rate generated by the scheme of the embodiments is lower through the deletion of the entire file; through the double-level index architecture of the file-data block, the time complexity of data indexing is reduced from O(n) to O(logN), which greatly reduces the data indexing delay and improves the data retrieval efficiency.

[0028] In addition to the objects, features and advantages described above, the present application has other objects, features and advantages. The present application will be further described in detail below with reference to the accompanying drawings. BRIEF DESCRIPTION OF DRAWINGS

[0029] The accompanying drawings, which form a part of this application, are included to provide a further understanding of the application, illustrate the preferred embodiments of the application and assist in the explanation of the application. In the drawings:

[0030] Figure 1 is a data storage flowchart of recording time cycle data according to the preferred embodiments of the present application;

[0031] Figure 2 is a data read flowchart of recording time cycle data according to the preferred embodiments of the present application. DETAILED DESCRIPTION

[0032] The embodiments of the present application will be described in detail below with reference to the accompanying drawings, but the present application can be implemented in various different ways limited and covered by the claims.

[0033] In addition, unless otherwise defined, technical terms or scientific terms used in the description of the present application shall be understood as the common meaning understood by one of ordinary skill in the art to which the present application belongs. The words "upper", "lower", "left", "right", "center", "vertical", "horizontal", "inner", "outer" and the like used in the description of the present application indicate relative directions or positional relationships only and are not intended to imply that the device or element must have a particular orientation, be constructed and operated in a particular orientation, and the relative positional relationship can change accordingly when the absolute position of the described object changes, and therefore cannot be understood as a limitation on the present application. The words "first", "second", "third" and the like used in the description of the present application are only for the purpose of description and are used to distinguish different components, and cannot be understood as indicating or implying relative importance. The words "one", "an" or "the" and the like used in the description of the present application should not be understood as an absolute limitation on the number, but should be understood as the presence of at least one. The words "include" or "contain" and the like used in the description of the present application mean that the elements or objects listed before the word cover the elements or objects listed after the word and their equivalents, and do not exclude other elements or objects.

[0034] It should also be noted that, unless otherwise specified and limited, the words "mount", "connect", "connect" and the like used in the description of the present application should be understood broadly, for example, the connection can be fixed connection, or detachable connection, or integral connection; can be mechanical connection, or electrical connection; can be directly connected, or indirectly connected through intermediate medium, or the connection between two elements, those skilled in the art can understand the specific meaning of the present application according to the specific circumstances.

[0035] As shown in Figure 1 The method for recording time cycle data of the present embodiment includes a data storage method and a data retrieval method, and the data storage method includes the following steps:

[0036] S1: initialize the maximum number of files N, the single file capacity S and the total storage duration D;

[0037] S2: when writing a data block with a timestamp, detect the remaining space of the current file;

[0038] S3: when the remaining space of the current file is sufficient, write the data block into the current file, when the remaining space of the current file is insufficient, create a new file and write the data block into the new file, and update the file end timestamp after the data block is written;

[0039] S4: when the number of files reaches N, delete the oldest file;

[0040] S5: continuously update the total storage duration D = latest file end timestamp - oldest file start timestamp.

[0041] The method of the embodiment records time cycle data, each data block is independently recorded time, only part of data of one data block is lost after power failure, the data loss rate is lower, and the generated fragments are less; meanwhile, through deletion of the entire file, compared with the traditional byte-overwriting mode, the fragment rate generated by the scheme of the embodiment is lower; through the double-level index architecture of file-data block, the time complexity of data index is reduced from O(n) to O(logN), the data index delay is greatly reduced, and the data retrieval efficiency is improved.

[0042] In some embodiments, step S3 specifically comprises:

[0043] S31: when the capacity of the data block and the current file is less than or equal to the single file capacity S, the data block is written into the current file and the file end timestamp is updated;

[0044] S32: when the capacity of the data block and the current file is greater than the single file capacity S, a new file is created, the data block is written into the new file, and the file end timestamp is updated.

[0045] The timestamp of the data block is the starting time of the data block, when the first data block is written into the file, the timestamp of the data block is updated to the starting timestamp of the file, when the file end timestamp needs to be updated after the data block is written, the file end timestamp is equal to the timestamp of the written data block plus the duration of the written data block, when the last data block is written into the file, the timestamp of the data block plus the duration of the data block is the end timestamp of the file, and thus the total duration of the file is the sum of the durations of all data blocks in the file, and meanwhile, in the file, the data blocks are arranged in time sequence, and when a specific data block is searched, the specific data block can be quickly located.

[0046] In some embodiments, in step S3, when the data block is written into the file, the position of the data block in the file also needs to be recorded.

[0047] By recording the position of the data block in the file, when a specific data block is searched, the specific data block can be quickly located through a quick addressing mechanism, and the recorded data block position can also track the idle area, ensure that new data is written into continuous space, and reduce the fragment rate.

[0048] In some embodiments, when the oldest file is deleted in step S4, the starting timestamp of the file index matrix is updated synchronously.

[0049] The file index matrix includes a file ID, a file start timestamp and a file end timestamp, thereby constructing a first-level index. When searching for a specific data block, the data block can be located by the timestamp to the file in which the data block is located, and then searched in the file. The two-level index architecture reduces the time complexity of data index from O(n) to O(logN), greatly improving the data retrieval efficiency.

[0050] When updating the files, for example, when the maximum number of files is 5 and the 5th file is full and needs to create the 6th file, the 1st file is deleted. At this time, the 2nd file becomes the first file, that is, the oldest file. At this time, the start timestamp of the 2nd file is taken as the start timestamp of the file index matrix, the start timestamp of the first file of the file index matrix is taken as the start timestamp of the file index matrix, the end timestamp of the last file of the file index matrix is taken as the end timestamp of the file index matrix, and the time difference between the end timestamp of the file matrix and the start timestamp of the file index matrix is the total storage duration D.

[0051] In some embodiments, as shown in Figure 2 The data retrieval method includes the following steps:

[0052] S6: Obtain a start time t and determine whether the time t is within a valid time range;

[0053] S7: Obtain a file F1 corresponding to the start time t;

[0054] S8: Read data from a first data block BlockA with a timestamp greater than or equal to the start time t.

[0055] The start time t is a specific data block to be located. For example, in a storage of a 1-hour video, a specific time period of video data is required, and the start time of the specific time period is the start time t in this embodiment.

[0056] When determining whether the time t is within the valid time range, the valid time range is the time from the start timestamp of the file index matrix to the system time (that is, the end timestamp of the file index matrix). When the start time t is within the valid time range, the file F1 corresponding to the start time t is located first, and then data is read from the first data block BlockA with a timestamp greater than or equal to the start time t, thereby realizing the search and location of the specific data block.

[0057] In some embodiments, step S8 specifically includes the following steps:

[0058] S81: Read the data block BlockA and its time Ta;

[0059] S82: read the next data block BlockB, and obtain its time as Tb;

[0060] S83: wait for (Tb-Ta) seconds, and then use the data block BlockB, and set Ta=Tb, and return to step S82 until the data reading is completed.

[0061] When the time lengths of the multiple data blocks in one file are the same, the data blocks can be read in sequence from the starting data block BlockA until the end. When the time lengths of the multiple data blocks in one file are different, for example, when the time length of BlockB is greater than that of BlockA, after the data block BlockA is read, the data block BlockB is read, and the data block BlockB needs to be waited for (Tb-Ta) seconds before being used, and then the time length of the data block BlockB is assigned to the time Ta to facilitate the reading of the next data, and the reading is sequentially performed until the data reading is completed.

[0062] In the embodiment, the file F1 corresponding to the starting time t obtained in step S7 adopts a binary search algorithm, and the first data block BlockA with the time stamp greater than or equal to the starting time t obtained in step S8 also adopts the binary search algorithm. Through the binary search algorithm, the number of comparisons is less, the time complexity can be reduced, and the data searching is faster.

[0063] The embodiment will be described through a specific application example, and the application example is specifically a digital television live broadcast playback storage system. It needs to be noted that the application example is only used for describing the embodiment of the application, and cannot be understood as a limitation on the application.

[0064] The maximum number of files N is 4, the capacity of a single file S is 100 MB, the video data block is 1 MB, each block stores about 1 second of 1080P video stream, and the accuracy of the time stamp is millisecond level.

[0065] After the file index is initialized, the file ID of the first file is file 0, the starting time stamp is 0, the ending time stamp is 0, and the total storage time length is 0.

[0066] Taking the live broadcast from 8:00:00 to 8:08:00 on January 1, 2025 as an example, during the data writing process, at 8:00:00, the first data block starts to be written, the data block size is 1 MB, the time is 1 S, and the time stamp is 1735689600000 (8:00:00). Since the remaining capacity of file 0 is 100 MB>1 MB, the data block is written into file 0, the starting time stamp of file 0 is updated to 1735689600000 (8:00:00), the ending time stamp of file 0 is the starting time stamp of the data block+the time length of the data block, and therefore the ending time stamp of file 0 is updated to 1735689601000 (8:00:01), and the current file 0 uses 1 MB.

[0067] After file 0 accumulatively writes 100 blocks, i.e. after 8:01:40, the 101st data block will be written into newly created file 1, and the file ID is updated to 1. At this time, the file index of file 0 is updated as: file ID: file 0, start timestamp 1735689600000 (8:00:00), end timestamp 1735689700000 (8:01:40). After the 101st data block is written into file 1, the file index is newly added as: file ID: file 1, start timestamp 1735689700000 (8:01:40), end timestamp 1735689701000 (8:01:41). File 1 currently uses 1 MB, and the total storage duration is 1 minute and 41 seconds.

[0068] At 8:02:00, the most recently written data block is the data block from 8:01:59 to 8:02:00, the data block size is 1 MB, the time is 1 second, the timestamp is 1735689719000 (8:01:59), and the data block is written into file 1. At this time, the file index of file 1 is updated as: file ID: file 1, start timestamp 1735689700000 (8:01:40), end timestamp 1735689720000 (8:02:00). File 1 currently uses 20 MB, and the total storage duration is 2 minutes.

[0069] At 8:06:00, the most recently written data block is the data block from 8:05:59 to 8:06:00, the data block size is 1 MB, the time is 1 second, and the timestamp is 1735689959000 (8:05:59). At this time, 360 data blocks have been written, so 3 files are needed. The data block from 8:05:59 to 8:06:00 needs to be written into the 4th file. At this time, file 2 is full, and the data block is written into file 3. The index of file 3 is updated as: file ID: file 3, start timestamp 1735689900000 (8:05:00), end timestamp 1735689960000 (8:06:00). File 3 currently uses 60 MB, and the total storage duration is 6 minutes.

[0070] At 8:08:00, the live broadcast has stopped, so the last data block written at 8:07:59-8:08:00 is 1 MB in size, 1 second in length, and the timestamp is 1735690079000 (8:07:59). At this time, the 4th folder has been full after writing 400 data blocks, and from the 401st data block, that is, from 8:06:40, file 0 is deleted and replaced with file 4. The starting timestamp of file 4 is 1735690000000 (8:06:40). After the last data block is written, the final index of file 4 is updated as follows: file ID: file 4, starting timestamp: 1735690000000 (8:06:40), ending timestamp: 1735690080000 (8:08:00), and file 4 finally uses 80 MB.

[0071] Therefore, the final file index list of the digital television live broadcast playback storage system of the embodiment is as follows:

[0072] File ID = 1: 8:01:40-8:03:20;

[0073] File ID = 2: 8:03:20-8:05:00;

[0074] File ID = 3: 8:05:00-8:06:40;

[0075] File ID = 4: 8:06:40-8:08:00.

[0076] The total storage time is 6 minutes and 20 seconds.

[0077] When retrieving the stored content by time, for example, the user requests to start playback at 8:05:42. First, the valid time needs to be determined, valid time = current system time (8:08:00) - total storage time (6 minutes and 20 seconds), that is, the valid time is 8:01:40-8:08:00, and the starting time 8:05:42 is within the valid time, so playback can be performed.

[0078] The starting time 8:05:42 (1735689942000) belongs to the file with file ID = 3 by using the binary search positioning algorithm. File 3 includes 100 data blocks, and the first data block greater than or equal to the starting time 8:05:42 is the data block with a timestamp of 1735689942000 (8:05:42). It should be noted that the user selects any time between 1735689942000 and 1735689943000, and selects the data block with a timestamp of 1735689942000 (8:05:42).

[0079] From 8:05:42, sequentially play the data blocks from 8:05:42 to 8:08:00 until all data blocks are played completely.

[0080] In the digital television live broadcast playback storage system of the embodiment, when the power-off recovery test is performed, for example, the power is off at 8:05:20, file 2 is completely written with data, file 3 is partially written with data, the last timestamp is 1735689920000 (8:05:20), file 3 is written with a total of 20 data blocks, and the total storage duration is 5 minutes and 20 seconds. Since the data block is the smallest unit in the application, after the power is turned on, all the data blocks can be recovered.

[0081] In some embodiments, when the power is off at 8:05:20 and 20 ms later, the timestamp is 1735689920200, the 21st data block of file 3 is written with 20%, and only 20% of one data block is fragmented after the power is turned off. At this time, a total of 320 data blocks have been stored, and the fragmentation rate is only 0.06%. If the size of the data block is set to be smaller, the fragmentation rate will also be smaller, and the data loss rate will be lower. Therefore, the application not only ensures a lower data loss rate when the power is turned off, but also makes the fragmentation rate lower.

[0082] In summary, the method for recording time cycle data of the embodiment has at least the following characteristics:

[0083] 1. When searching for a data block, the two-level index architecture of file-data block is used to reduce the time complexity of data index from O(n) to O(logN), greatly reducing the data index delay and improving the data retrieval efficiency.

[0084] 2. When deleting a file, the entire file is deleted by replacing the byte coverage mode, so the fragmentation rate is lower.

[0085] 3. Each data block has an independent timestamp, so only part of the data of one data block will be lost after the power is turned off, and the rest of the data can be recovered. The power-off recovery degree is higher, and the damage of a single file does not affect other time period data.

[0086] The embodiment of the application also provides an electronic device, which includes one or more processors and a memory. The memory is connected to the one or more processors, for example, through a bus.

[0087] The processor is configured to support the electronic device to perform the corresponding functions in the methods in the above method embodiments. The processor can be a central processing unit (CPU), a network processor (NP), a hardware chip, or any combination thereof. The hardware chip can be an application specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The PLD can be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.

[0088] The memory is used to store program codes and the like. The memory can include a volatile memory (VM), such as a random access memory (RAM); the memory can also include a non-volatile memory (NVM), such as a read-only memory (ROM), a flash memory, a hard disk drive (HDD), or a solid-state drive (SSD); and the memory can further include a combination of the above types of memories.

[0089] The memory can be used to store non-volatile software programs, non-volatile computer executable programs, and modules, such as program instructions / modules corresponding to the method of recording time cycle data in the embodiments of the present application. The processor performs various functional applications and data processing of the method of recording time cycle data by running the non-volatile software programs, instructions, and modules stored in the memory, that is, realizes the functions of each module or unit of the method of recording time cycle data provided in the above method embodiments.

[0090] The memory can include a program storage area and a data storage area, wherein the program storage area can store an operating system, at least one application required by a function. The data storage area can store data created according to the use of the method of recording time-cyclic data, etc. In some embodiments, the memory can optionally include a memory remotely arranged relative to the processor, which can be connected to the editing device of the method of recording time-cyclic data through a network. Examples of the network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0091] One or more modules are stored in the memory, which, when executed by one or more processors, perform the method of recording time-cyclic data in any of the above method embodiments, for example, perform the method steps described in the above method embodiments.

[0092] The embodiments of the present application also provide a computer readable storage medium, which stores a computer program, and the computer program includes program instructions, which, when executed by a computer, cause the computer to perform the method of the above embodiments.

[0093] Those skilled in the art can understand that all or part of the processes in the above method embodiments can be completed by a computer program instructing related hardware, and the program can be stored in a computer readable storage medium, which, when executed, can include the processes of the above method embodiments. The storage medium can be a magnetic disc, an optical disc, a read-only memory (ROM) or a random access memory (RAM), etc.

[0094] The above only describes the preferred embodiments of the present application and is not used to limit the present application. Those skilled in the art can make various modifications and changes to the present application. Any modification, equivalent replacement, improvement, etc. within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A method for recording time cycle data, characterized in that: It includes a data storage method and a data retrieval method, wherein the data storage method includes the following steps: S1: Initialize the maximum number of files N, the capacity of a single file S, and the total storage time D; S2: When writing a data block with a timestamp, detect the remaining space of the current file; S3: When the current file has sufficient remaining space, the data block is written to the current file. When the current file has insufficient remaining space, a new file is created and the data block is written to the new file. After the data block is written, the file end timestamp is updated. S4: When the number of files reaches N, delete the oldest file; S5: Continuously update the total storage duration D = the latest file end timestamp - the oldest file start timestamp.

2. The method for recording time cycle data according to claim 1, characterized in that: The step S3 specifically includes: S31: When the sum of the capacity of the data block and the current file is less than or equal to the single file capacity S, the data block is written to the current file and the file end timestamp is updated; S32: When the sum of the capacity of the data block and the current file is greater than the single file capacity S, a new file is created, the data block is written into the new file, and the file end timestamp is updated.

3. The method for recording time cycle data according to claim 1, characterized in that: In step S3, when a data block is written into a file, the position of the data block in the file also needs to be recorded.

4. The method for recording time cycle data according to claim 1, characterized in that: When the oldest file is deleted in step S4, the start timestamp of the file index matrix is ​​synchronously updated.

5. The method for recording time cycle data according to claim 1, characterized in that: The timestamp is the start time of the data block. When the file end timestamp is updated, the file end timestamp = the timestamp of writing the data block + the duration of writing the data block.

6. The method for recording time cycle data according to claim 1, characterized in that: The data retrieval method The following steps are involved: S6: Get the start time t and determine whether the time t is within the valid time range; S7: Obtain the file F1 corresponding to the start time t; S8: Start reading data from the first data block BlockA whose timestamp is greater than or equal to the start time t.

7. The method for recording time cycle data according to claim 6, characterized in that: The step S8 specifically includes the following steps: S81: Read data block BlockA and its time Ta; S82: Read the next data block BlockB and obtain its time as Tb; S83: After waiting for (Tb-Ta) seconds, use the data block BlockB, set Ta=Tb, and return to step S82 until the data reading is completed.

8. The method for recording time cycle data according to claim 6, characterized in that: In step S7, the file F1 corresponding to the start time t is obtained by using a binary search algorithm. In step S8, the first data block BlockA whose timestamp is greater than or equal to the start time t is obtained by also using a binary search algorithm.

9. An electronic device, characterized in that: The electronic device comprises a memory and a processor, wherein the memory is connected to the processor, and the processor is used to execute one or more computer programs stored in the memory. When the processor executes the one or more computer programs, the electronic device implements the method according to any one of claims 1 to 8.

10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the processor is caused to perform the method according to any one of claims 1 to 7.