definition
Time stamp refers to the total number of seconds from GMT197001010000: 00 (Beijing time 1970 0 1 0800: 00) to now.
classify
1. Self-built timestamp: This timestamp obtains time from time receiving equipment (such as GPS, CDMA, Beidou satellite) and issues a timestamp certificate through a timestamp server. This time stamp can be used to identify the internal responsibility of the enterprise, and it has no legal effect after being certified by the court. Because the time received by the time receiving device may be tampered with, it cannot be used as a legal basis.
2. Time stamp with legal effect: it is a domestic third-party trusted time stamp authentication service jointly established by the National Time Service Center of Chinese Academy of Sciences and Beijing United Trusted Technology Service Co., Ltd., and the National Time Service Center is responsible for timing and punctuality monitoring. Because of its on-time monitoring function, the time in the timestamp certificate is guaranteed to be accurate and not tampered with. The platform for obtaining time stamps is the "Public Copyright Protection Platform", which can be synchronized with the National Time Service Center of Chinese Academy of Sciences.
Time stamp in database system
A unique binary number automatically generated in a database, independent of time and date, is usually used as a mechanism to add version tags to table rows. The storage size is 8 bytes.
Each database has a counter, and the value of the counter will increase when a table containing timestamp columns is inserted or updated in the database. This counter is a database timestamp. This can track the relative time in the database, rather than the actual time associated with the clock. A table can only have one timestamp column. Every time a row containing a timestamp column is modified or inserted, an incremental database timestamp value is inserted in the timestamp column. This attribute makes timestamp columns unsuitable for keys, especially primary keys. Any update to the row will change the timestamp value, thus changing the key value. If the column belongs to the primary key, the old key value will be invalid, and the foreign key that references the old value will no longer be valid. If the table is referenced in a dynamic cursor, all updates will change the position of rows in the cursor. If the column belongs to the index key, all updates to the data row will also cause the index to be updated.
Using the timestamp column in a row can easily determine whether any values in the row have changed since the last reading. If the itinerary changes, the timestamp value will be updated. If no changes are made to the row, the timestamp value will be the same as the timestamp value when the row was previously read. To return the current timestamp value of the database, use @@DBTS.
Play a role in controlling concurrency.
User A/B opens a record at the same time and starts editing. You can judge the time stamp when saving, because the system will automatically maintain the time stamp every time the record is updated, so if the time stamp taken out when saving is not equal to the time stamp in the database, it means that the record has been updated in this process, which can prevent others' updates from being overwritten.