Time label processing method and apparatus, and non-transitory storage medium

By utilizing time stamp processing methods in a new generation of distributed real-time database platform, the target time is determined to solve the problem of asynchronous time stamps in the source data. This enables accurate acquisition of the time required to update the source data, meeting the needs of real-time data processing.

CN116932595BActive Publication Date: 2026-04-21SUPCON TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310896481.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-07-19
Publication Date
2026-04-21
Estimated Expiration
2043-07-19

AI Technical Summary

Technical Problem

In the new generation of distributed real-time database platforms, the timestamps of updated source data may become out of sync, making it impossible to accurately obtain the time required to update the source data.

Method used

By obtaining the timestamps corresponding to the updated source data, and when the difference between the time corresponding to the timestamp and the local time is within a preset range, the time corresponding to the timestamp is determined as the target time. Two consecutive target times are compared sequentially to ensure that the difference is within the preset range, and the second target time is determined as the final target time.

Benefits of technology

This avoids the situation where the timestamps of the updated source data are out of sync, and enables accurate acquisition of the time required to update the source data, thus meeting the requirements for real-time data processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116932595B_ABST
    Figure CN116932595B_ABST
Patent Text Reader

Abstract

This application discloses a time stamp processing method and apparatus, and a non-volatile storage medium. The method includes: acquiring the time stamp corresponding to the updated source data; determining the time corresponding to the time stamp as a target time if the difference between the time stamp and the local time is within a first preset range; sequentially comparing a first target time and a second target time; and determining the second target time as the target time if the first target time is less than the second target time and the difference between the first and second target times is within a second preset range. This application solves the technical problem of being unable to obtain the time required to update the source data due to potential time stamp asynchrony in the updated source data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing technology, and more specifically, to a time stamp processing method and apparatus, and a non-volatile storage medium. Background Technology

[0002] The next-generation distributed real-time database platform VxBase supports real-time computation on one or more source data sets. When the source data changes or a fixed period of time passes, the database takes the source data as input, performs calculations according to the user-specified expression, and outputs the results. The results include three elements: timestamps, values, and quality codes. In the output results, when the timestamps of the source data are fully synchronized, the computation time can be referenced from the timestamp of any source data set; however, when the timestamps of the source data are not synchronized, obtaining the computation timestamp becomes a challenge.

[0003] There is currently no effective solution to the above problems. Summary of the Invention

[0004] This application provides a time stamp processing method and apparatus, and a non-volatile storage medium, to at least solve the technical problem that the time required to update the source data cannot be obtained due to the possibility that the time stamps corresponding to the updated source data may be out of sync.

[0005] According to one aspect of the embodiments of this application, a time tag processing method is provided, comprising: obtaining a time tag corresponding to updated source data; determining the time corresponding to the time tag as a target time when the difference between the time corresponding to the time tag and the local time is within a first preset range, wherein the target time is used to represent the time required to update the source data in the time tag; sequentially comparing a first target time and a second target time, wherein the first target time and the second target time are any two consecutive target times, and the first target time is the time after the second target time; determining the second target time as the target time when the first target time is less than the second target time and the difference between the first target time and the second target time is within a second preset range.

[0006] Optionally, before obtaining the timestamp corresponding to the updated source data, the method further includes: determining whether the unupdated source data includes a timestamp field; if the unupdated source data includes a timestamp field, determining the first format corresponding to the timestamp field; if the first format is a string, using a preset function to parse the first format into a second format for representing time; converting the second format into a time object to obtain the timestamp corresponding to the unupdated source data, wherein the time object includes at least a time attribute.

[0007] Optionally, if the difference between the time corresponding to the time tag and the local time is not within a first preset range, the local time is determined as the target time.

[0008] Optionally, the updated source data also includes a quality code, wherein, when the local time is determined as the target time, and when the second target time is determined as the target time, the quality code is set to a first value within a preset value range, wherein the first value is used to indicate that the corresponding time in the time tag has been corrected.

[0009] Optionally, if the number of timestamps corresponding to the updated source data is x, then the difference between each of the x timestamps and the local time is determined sequentially, where x is a positive integer greater than 1; if the difference between y times and the local time is within the first preset range, then the y times are weighted and summed according to the quality code of the updated source data to obtain the target time, where y is a positive integer less than or equal to x.

[0010] Optionally, if the difference between the first target time and the second target time is not within a second preset range, the first target time is determined as the target time.

[0011] Optionally, within a preset duration, the time tag corresponding to the updated source data is obtained at preset time intervals; if the target time interval is greater than the preset time interval, it is determined whether the difference between the time corresponding to the time tag and the local time is within a first preset range; if the difference between the time corresponding to the time tag and the local time is within the first preset range, the time corresponding to the time tag is determined as the target time.

[0012] According to another aspect of the embodiments of this application, a time tag processing apparatus is also provided, comprising: an acquisition module, configured to acquire a time tag corresponding to updated source data; a first determination module, configured to determine the time corresponding to the time tag as a target time when the difference between the time corresponding to the time tag and the local time is within a first preset range, wherein the target time is used to represent the time required to update the source data in the time tag; a comparison module, configured to sequentially compare a first target time and a second target time, wherein the first target time and the second target time are any two consecutive target times, and the first target time is the time after the second target time; and a second determination module, configured to determine the second target time as the target time when the first target time is less than the second target time and the difference between the first target time and the second target time is within a second preset range.

[0013] According to another aspect of the embodiments of this application, a non-volatile storage medium is also provided, the storage medium including a stored program, wherein the program, when running, controls the device where the storage medium is located to execute the above-mentioned time stamp processing method.

[0014] According to another aspect of the embodiments of this application, an electronic device is also provided, including: a memory and a processor, the processor being configured to run a program stored in the memory, wherein the program executes the above-described time tag processing method during runtime.

[0015] In this embodiment, the method involves obtaining the timestamp corresponding to the updated source data; determining the timestamp corresponding to the target time when the difference between the timestamp and the local time is within a first preset range, wherein the target time is used to represent the time required to update the source data in the timestamp; sequentially comparing the first target time and the second target time, wherein the first target time and the second target time are any two consecutive target times, and the first target time is the time after the second target time; and determining the second target time as the target time when the first target time is less than the second target time and the difference between the first target time and the second target time is within a second preset range. By determining the timestamp corresponding to the target time when the difference between the timestamp and the local time is within a first preset range, the method avoids the possibility of the timestamp corresponding to the updated source data being out of sync, thereby achieving the technical effect of obtaining the time required to update the source data. This solves the technical problem of being unable to obtain the time required to update the source data due to the possibility of the timestamp corresponding to the updated source data being out of sync. Attached Figure Description

[0016] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments of this application and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:

[0017] Figure 1 This is a flowchart of a time stamp processing method according to an embodiment of this application;

[0018] Figure 2 This is a flowchart of another time stamp processing method according to an embodiment of this application;

[0019] Figure 3 This is a structural diagram of a tag processing apparatus according to an embodiment of this application;

[0020] Figure 4 This is a hardware structure block diagram of a computer terminal (or electronic device) according to an embodiment of the present application of a time stamp processing method. Detailed Implementation

[0021] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0022] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0023] According to an embodiment of this application, a method embodiment for processing time stamps is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.

[0024] Figure 1 This is a flowchart of a time stamp processing method according to an embodiment of this application, such as... Figure 1 As shown, the method includes the following steps:

[0025] Step S102: Obtain the time tag corresponding to the updated source data.

[0026] According to some optional embodiments of this application, the timestamps corresponding to the updated source data can be in the following forms:

[0027] 1. Timestamp: The number of seconds or milliseconds counted from a specific starting point (such as January 1, 1970). Common timestamps include Unix timestamps and Java timestamps.

[0028] 2. Year-Month-Day (YYYY-MM-DD): This format represents the year, month, and date, such as 2021-12-31.

[0029] 3. First date and time (YYYY-MM-DD HH:MM:SS): In addition to the year, month and day, it also includes the hour, minute and second format, such as 2021-12-31 23:59:59.

[0030] 4. Second date and time (YYYY-MM-DD HH:MM:SS.sss): In addition to year, month, day, hour, minute and second, it also includes the millisecond format, such as 2021-12-31 23:59:59.999.

[0031] 5. ISO 8601 format: A time and date representation method defined by the International Organization for Standardization, commonly used for timestamps across time zones. For example, 2021-12-31T23:59:59Z represents 23:59:59 on December 31, 2021, at UTC.

[0032] 6. Custom format: The format of the time tag can be customized according to specific needs, such as using only the year, month or quarter, etc.

[0033] Step S104: If the difference between the time corresponding to the time tag and the local time is within a first preset range, the time corresponding to the time tag is determined as the target time, wherein the target time is used to represent the time required to update the source data in the time tag.

[0034] According to some alternative embodiments of this application, the source data is processed using the VxBase database platform. The source data before the update is input into the database platform to obtain the updated source data. The time when the source data before the update is input into the database platform is defined as zero point or a reference time. Then, based on the reference time and the time corresponding to the time stamp, the time required to update the source data can be determined.

[0035] Step S106: Compare the first target time and the second target time in sequence, wherein the first target time and the second target time are any two consecutive target times, and the first target time is the time after the second target time.

[0036] Step S108: If the first target time is less than the second target time, and the difference between the first target time and the second target time is within a second preset range, the second target time is determined as the target time.

[0037] As some optional embodiments of this application, when updating or calculating multiple source data, a first target time 'a' required to update the first source data A and a second target time 'b' required to update the second source data B are compared, wherein the first source data A is the source data input into the calculation model after the second source data B. The first target time 'a' and the second target time 'b' are compared. If 'a < b', it is determined whether the difference between 'a' and 'b' is within a second preset range, or whether the absolute value of the difference between 'a' and 'b' is within a third preset range. If the difference between 'a' and 'b' is within the second preset range, or if the absolute value of the difference between 'a' and 'b' is within the third preset range, then 'b' is determined as the target time.

[0038] Based on the above steps, by determining the time corresponding to the time tag as the target time when the difference between the time tag and the local time is within a first preset range, the goal of avoiding the possibility of the time tag corresponding to the updated source data being out of sync is achieved, thereby realizing the technical effect of obtaining the time required to update the source data.

[0039] According to some optional embodiments of this application, before obtaining the timestamp corresponding to the updated source data, it is also necessary to: determine whether the unupdated source data includes a timestamp field; if the unupdated source data includes a timestamp field, determine the first format corresponding to the timestamp field; if the first format is a string, use a preset function to parse the first format into a second format for representing time; convert the second format into a time object to obtain the timestamp corresponding to the unupdated source data, wherein the time object includes at least a time attribute.

[0040] According to some alternative embodiments of this application, it is determined whether the data source provides a timestamp or a timestamp field, wherein the timestamp may be part of the data or exist as a separate column or attribute; if the source data provides a timestamp field, the format of the timestamp field is determined, wherein common timestamp formats include date and time, such as "YYYY-MM-DD HH:MM:SS", or a date-only format, such as "YYYY-MM-DD"; if the timestamp field exists in the form of a string, it is parsed into a date or time format for use in subsequent analysis and visualization; if the timestamp is parsed, it is converted into a time object for further time-related operations, wherein the time object typically contains attributes such as year, month, day, hour, minute, and second, which facilitates time calculation and comparison.

[0041] In some optional embodiments of this application, if the difference between the time corresponding to the time tag and the local time is not within a first preset range, the local time is determined as the target time.

[0042] As some optional embodiments of this application, the updated source data further includes: a quality code, wherein, when the local time is determined as the target time, and when the second target time is determined as the target time, the quality code is set to a first value within a preset value range, wherein the first value is used to indicate that the corresponding time in the time tag has been corrected.

[0043] A quality code is an evaluation code for data quality within a specific time period. It indicates the reliability and accuracy of the data, helping users determine its trustworthiness. Optionally, quality codes include: 0 - No data: Indicates no usable data within this time period; 1 - Excellent data: Indicates very high data quality, having undergone multiple verifications and corrections; 2 - Good data: Indicates good data quality, having undergone some verification and corrections; 3 - Medium data: Indicates average data quality, possibly containing some errors or incompleteness; 4 - Poor data: Indicates poor data quality, possibly containing many errors or inaccuracies; 5 - Unknown data: Indicates that the data quality cannot be accurately assessed, possibly due to data loss or unavailability.

[0044] In some optional embodiments of this application, when the number of time tags corresponding to the updated source data is x, it is sequentially determined whether the difference between each of the x times among the x time tags and the local time is within a first preset range, where x is a positive integer greater than 1; when the difference between y times and the local time is within the first preset range, the y times are weighted and summed according to the quality code of the updated source data to obtain the target time, where y is a positive integer less than or equal to x.

[0045] As some alternative embodiments of this application, if the difference between the first target time and the second target time is not within a second preset range, the first target time is determined as the target time.

[0046] In some optional embodiments, within a preset duration, the time tag corresponding to the updated source data is obtained at preset time intervals; if the target time interval is greater than the preset time interval, it is determined whether the difference between the time corresponding to the time tag and the local time is within a first preset range; if the difference between the time corresponding to the time tag and the local time is within the first preset range, the time corresponding to the time tag is determined as the target time.

[0047] Figure 2 This is a flowchart of another time stamp processing method according to an embodiment of this application, such as... Figure 2 As shown, the method includes the following steps:

[0048] Step S202: When the source data is updated, obtain the source data timestamp.

[0049] Step S204: Compare the source data time with the local time. If the time difference is within the allowable error range, use the source data time as the calculation time; otherwise, use the local time as the calculation time.

[0050] It is understandable that computation time is the time required to update the source data using a database or computational model.

[0051] Step S206: Compare the current value and the previous value of the calculation time. If the calculation time is moved back, and the move is within the allowable error range, then the current value of the calculation time is set to the previous value; otherwise, the time is moved back without further processing.

[0052] Step S208: Process real-time data based on the updated calculation time.

[0053] Optionally, real-time data processing can be applied to, but is not limited to, the following two scenarios: periodic calculations and calculations performed when data changes. Specifically, periodic calculations refer to data calculations performed at regular time intervals. For example, if the calculation interval is 5 seconds, the system will output the calculation results at 0 seconds, 5 seconds, ..., 55 seconds. Calculations will be triggered when the calculation time exceeds these time points. Calculations performed when the source data on which the data calculation depends changes refer to calculations performed when the source data changes.

[0054] The above steps do not require the source data to have time synchronization capabilities to output calculation results. Furthermore, these steps allow for outputting calculation results even when the source data's time stamps are out of sync; they also enable real-time correction of calculation results, meeting the requirements for real-time data processing.

[0055] Figure 3 This is a structural diagram of a time stamp processing apparatus according to an embodiment of this application, as shown below. Figure 3 As shown, the device includes:

[0056] Module 30 is used to obtain the timestamps corresponding to the updated source data.

[0057] The first determining module 32 is used to determine the time corresponding to the time tag as the target time when the difference between the time corresponding to the time tag and the local time is within a first preset range. The target time is used to represent the time required to update the source data in the time tag.

[0058] Comparison module 34 is used to compare the first target time and the second target time in sequence, wherein the first target time and the second target time are any two consecutive target times, and the first target time is the time after the second target time;

[0059] The second determining module 36 is used to determine the second target time as the target time when the first target time is less than the second target time and the difference between the first target time and the second target time is within a second preset range.

[0060] It should be noted that the above Figure 3 The modules in the above can be program modules (e.g., a set of program instructions that implement a specific function) or hardware modules. For the latter, they can be represented in the following forms, but are not limited to these: each of the above modules is represented by a processor, or the functions of each of the above modules are implemented by a processor.

[0061] It should be noted that, Figure 3 Preferred embodiments of the shown examples can be found in [reference needed]. Figure 1 The relevant descriptions of the embodiments shown will not be repeated here.

[0062] Optionally, before obtaining the timestamp corresponding to the updated source data, the method further includes: determining whether the unupdated source data includes a timestamp field; if the unupdated source data includes a timestamp field, determining the first format corresponding to the timestamp field; if the first format is a string, using a preset function to parse the first format into a second format for representing time; converting the second format into a time object to obtain the timestamp corresponding to the unupdated source data, wherein the time object includes at least a time attribute.

[0063] Optionally, if the difference between the time corresponding to the time tag and the local time is not within a first preset range, the local time is determined as the target time.

[0064] Optionally, the updated source data also includes a quality code, wherein, when the local time is determined as the target time, and when the second target time is determined as the target time, the quality code is set to a first value within a preset value range, wherein the first value is used to indicate that the corresponding time in the time tag has been corrected.

[0065] Optionally, if the number of timestamps corresponding to the updated source data is x, then the difference between each of the x timestamps and the local time is determined sequentially, where x is a positive integer greater than 1; if the difference between y times and the local time is within the first preset range, then the y times are weighted and summed according to the quality code of the updated source data to obtain the target time, where y is a positive integer less than or equal to x.

[0066] Optionally, if the difference between the first target time and the second target time is not within a second preset range, the first target time is determined as the target time.

[0067] Optionally, within a preset duration, the time tag corresponding to the updated source data is obtained at preset time intervals; if the target time interval is greater than the preset time interval, it is determined whether the difference between the time corresponding to the time tag and the local time is within a first preset range; if the difference between the time corresponding to the time tag and the local time is within the first preset range, the time corresponding to the time tag is determined as the target time.

[0068] Figure 4 A hardware block diagram of a computer terminal (or mobile device) for implementing a time-stamping processing method is shown. Figure 4 As shown, the computer terminal 40 (or mobile device 40) may include one or more processors 402 (shown as 402a, 402b, ..., 402n in the figure) (processor 402 may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.), a memory 404 for storing data, and a transmission module 406 for communication functions. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of a BUS bus), a network interface, a power supply, and / or a camera. Those skilled in the art will understand that... Figure 4 The structure shown is for illustrative purposes only and does not limit the structure of the aforementioned electronic device. For example, computer terminal 40 may also include... Figure 4 The more or fewer components shown, or having the same Figure 4 The different configurations shown.

[0069] It should be noted that the aforementioned one or more processors 402 and / or other data processing circuits are generally referred to herein as "data processing circuits". These data processing circuits may be embodied, in whole or in part, in software, hardware, firmware, or any other combination thereof. Furthermore, the data processing circuits may be a single, independent processing module, or may be integrated, in whole or in part, into any other element within the computer terminal 40 (or mobile device). As involved in the embodiments of this application, the data processing circuits serve as a processor control mechanism (e.g., selection of a variable resistor termination path connected to an interface).

[0070] The memory 404 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the time tag processing method in this embodiment. The processor 402 executes various functional applications and data processing by running the software programs and modules stored in the memory 404, thereby implementing the aforementioned time tag processing method. The memory 404 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 404 may further include memory remotely located relative to the processor 402, and these remote memories can be connected to the computer terminal 40 via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0071] The transmission module 406 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the communication provider of the computer terminal 40. In one example, the transmission module 406 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission module 406 may be a Radio Frequency (RF) module, used for wireless communication with the Internet.

[0072] The display can be, for example, a touchscreen liquid crystal display (LCD) that allows the user to interact with the user interface of the computer terminal 40 (or mobile device).

[0073] It should be noted here that, in some optional embodiments, the above... Figure 4 The computer device (or electronic device) shown may include hardware elements (including circuitry), software elements (including computer code stored on a computer-readable medium), or a combination of both hardware and software elements. It should be noted that... Figure 4 This is only one instance of a particular specific instance, and is intended to illustrate the types of components that may exist in the aforementioned computer equipment (or electronic equipment).

[0074] It should be noted that, Figure 4 The electronic device shown is used to perform Figure 1 The time stamp processing method shown above applies to this electronic device as well, and will not be repeated here.

[0075] This application also provides a non-volatile storage medium, which includes a stored program, wherein the program, when running, controls the device where the storage medium is located to execute the above-mentioned time stamp processing method.

[0076] A non-volatile storage medium performs the following functions: obtaining the timestamp corresponding to the updated source data; determining the time corresponding to the timestamp as the target time when the difference between the time corresponding to the timestamp and the local time is within a first preset range, wherein the target time is used to represent the time required to update the source data in the timestamp; sequentially comparing the first target time and the second target time, wherein the first target time and the second target time are any two consecutive target times, and the first target time is the time after the second target time; determining the second target time as the target time when the first target time is less than the second target time and the difference between the first target time and the second target time is within a second preset range.

[0077] This application also provides an electronic device, including a memory and a processor, wherein the processor is used to run a program stored in the memory, wherein the program executes the above-described time tag processing method during runtime.

[0078] The processor is used to run a program that performs the following functions: obtains the timestamp corresponding to the updated source data; if the difference between the time corresponding to the timestamp and the local time is within a first preset range, determines the time corresponding to the timestamp as the target time, wherein the target time is used to represent the time required to update the source data in the timestamp; sequentially compares the first target time and the second target time, wherein the first target time and the second target time are any two consecutive target times, and the first target time is the time after the second target time; if the first target time is less than the second target time, and the difference between the first target time and the second target time is within a second preset range, determines the second target time as the target time.

[0079] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0080] In the above embodiments of this application, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0081] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units can be a logical functional division, and in actual implementation, there may be other division methods. For instance, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling, direct coupling, or communication connection may be through some interfaces; the indirect coupling or communication connection between units or modules may be electrical or other forms.

[0082] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0083] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0084] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to related technologies, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.

[0085] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.

Claims

1. A method for processing time stamps, characterized in that, include: Get the timestamps corresponding to the updated source data; If the difference between the time corresponding to the time tag and the local time is within a first preset range, the time corresponding to the time tag is determined as the target time, wherein the target time is used to represent the time required to update the source data in the time tag, and both the time tag and the local time are time points; The first target time and the second target time are compared sequentially, wherein the first target time and the second target time are any two consecutive target times, and the first target time is the time after the second target time. If the first target time is less than the second target time, and the difference between the first target time and the second target time is within a second preset range, the second target time is determined as the target time. The method further includes: if the difference between the time corresponding to the time tag and the local time is not within the first preset range, determining the local time as the target time; The method further includes: determining the first target time as the target time when the first target time is less than the second target time, and when the difference between the first target time and the second target time is not within the second preset range.

2. The method according to claim 1, characterized in that, Before obtaining the timestamp corresponding to the updated source data, the method further includes: Determine whether the source data that has not been updated includes a timestamp field; If the timestamp field is included in the unupdated source data, determine the first format corresponding to the timestamp field; When the first format is a string, a preset function is used to parse the first format into a second format for representing time. The second format is converted into a time object to obtain the time tag corresponding to the unupdated source data, wherein the time object includes at least a time attribute.

3. The method according to claim 1, characterized in that, The updated source data also includes: a quality code, wherein, When the local time is determined as the target time, and when the second target time is determined as the target time, the quality code is set to a first value within a preset value range, wherein the first value is used to indicate that the corresponding time in the time tag has been corrected.

4. The method according to claim 3, characterized in that, include: When the number of timestamps corresponding to the updated source data is x, it is determined in turn whether the difference between each of the x times in the x timestamps and the local time is within the first preset range, where x is a positive integer greater than 1; If the difference between the y times and the local time is within the first preset range, the y times are weighted and summed according to the quality code of the updated source data to obtain the target time, where y is a positive integer less than or equal to x.

5. The method according to claim 1, characterized in that, The method further includes: Within a preset duration, the time tag corresponding to the updated source data is obtained at preset time intervals; If the target time interval is greater than the preset time interval, determine whether the difference between the time corresponding to the time tag and the local time is within the first preset range. If the difference between the time corresponding to the time tag and the local time is within the first preset range, determine the time corresponding to the time tag as the target time.

6. A time stamp processing device, characterized in that, include: The acquisition module is used to obtain the timestamps corresponding to the updated source data; The first determining module is used to determine the time corresponding to the time tag as the target time when the difference between the time corresponding to the time tag and the local time is within a first preset range, wherein the target time is used to represent the time required to update the source data in the time tag, and both the time tag and the local time are time points; The comparison module is used to compare a first target time and a second target time sequentially, wherein the first target time and the second target time are any two consecutive target times, and the first target time is the time after the second target time; The second determining module is used to determine the second target time as the target time when the first target time is less than the second target time and the difference between the first target time and the second target time is within a second preset range. The time tag processing device is further configured to perform the following steps: when the difference between the time corresponding to the time tag and the local time is not within the first preset range, the local time is determined as the target time; The time stamp processing device is further configured to perform the following steps: when the first target time is less than the second target time, and when the difference between the first target time and the second target time is not within the second preset range, the first target time is determined as the target time.

7. A non-volatile storage medium, characterized in that, The non-volatile storage medium includes a stored program, wherein, when the program is executed, it controls the device containing the non-volatile storage medium to perform the time stamp processing method according to any one of claims 1 to 5.

8. An electronic device, characterized in that, include: A memory and a processor, the processor being configured to run a program stored in the memory, wherein the program, when running, performs the time-stamp processing method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Time-based formatting of data

    EP1052584A2

  • A computer implemented method for determining a data synchronization state between a source database and a target database

    EP4141694A1