"Point in time" concept
The Date document attribute determines its position on the time axis. A date includes time with one second precision. This allows you to control the document writing order. However, when a large number of documents are created, some documents might have identical dates (because they are created within a single second). How does one determine the sequence of document creation in this situation?
The point in time concept has been introduced to deal with this problem. A point in time is composed of date, time, and a reference to a database object. This lets you explicitly identify the position of any reference type database object on the time axis, but it generally only applies to documents. The point in time also allows you to determine the order of nonobject data, such as register records that are subordinate to a recorder.
The point in time concept is implemented in 1C:Enterprise script as the universal PointInTime object. This object has the Date and Ref properties, which provide you with the option to get the point in time "components", and a single Compare() method that compares two points in time. Besides, a PointInTime object has a constructor and can be created explicitly for any database object of reference type.
For multiple documents that have identical dates and times, the platform determines their order on the time axis based on the references to these documents. The order does not always match the order of document creation, and it is not available to users, so they cannot change the order of documents within a one-second period or determine that one document was created before another.
The platform generates a real-time timestamp at each real-time document posting. The timestamp value is generated based on the current time and the last real-time timestamp generated.
If the last real-time timestamp that was generated is less than the current session time, the current session time is used as the new real-time timestamp.
If the last real-time timestamp is equal to or greater than the current session time, the real-time timestamp is set to a value one second greater than the old real-time timestamp.
So, the platform processes posting of Document configuration objects that have real-time posting enabled (fig. 14.30) as follows:
- When you create a document, the platform assigns the current date and "zero" time to the document.
- When you post a document with the same date (day) as the current session date, the platform assigns a real-time timestamp to the document date.
- When you cancel the document posting and repost it (without changing its date), the platform sets a new real-time timestamp.
- When you attempt to repost a document, the platform sets a new real-time timestamp and posts the document.
- If you attempt to post (or repost) a document with the date (day) earlier than the current session date, the platform posts the document in regular mode.
- If you attempt to post (or repost) a document with the date (day) later than the current session date, the platform prohibits the posting.
Fig. 14.30. Enabling real-time document posting