Книга: Distributed operating systems
10.4.1. DTS Time Model
10.4.1. DTS Time Model
Unlike most systems, in which the current time is simply a binary number, in DTS all times are recorded as intervals. When asked what the time is, instead of saying that it is 9:52, DTS might say it is somewhere between 9:51 and 9:53 (grossly exaggerated). Using intervals instead of values allows DTS to provide the user with a precise specification of how far off the clock might be.
Internally, DTS keeps track of time as a 64-bit binary number starting at the beginning of time. Unlike UNIX, in which time begins at 0000 on January 1, 1970, or TAI, which starts at 0000 on January 1, 1958, the beginning of time in DTS is 0000 on October 15, 1582, the date that the Gregorian calendar was introduced in Italy. (You never know when an old FORTRAN program from the 17th Century might turn up.)
People are not expected to deal with the binary representation of time. It is just used for storing times and comparing them. When displayed, times are shown in the format of Fig. 10-15. This representation is based on International Standard 8601 which solves the problem of whether to write dates as month/day/year (as in the United States) or day/month/year (everywhere else) by doing neither. It uses a 24-hour clock and records seconds accurately to 0.001 sec. It also effectively includes the time zone by giving the time difference from Greenwich Mean Time. Finally, and most important, the inaccuracy is given after the "I" in seconds. In this example, the inaccuracy is 5.000 seconds, meaning that the true time might be anywhere from 3:29:55 P.M. to 3:30:05 P.M. In addition to absolute times, DTS also manages time differences, including the inaccuracy aspect.
Fig. 10-15. Displaying time in DTS.
Recording times as intervals introduces a problem not present in other systems: it is not always possible to tell if one time is earlier than another. For example, consider the UNIX make program. Suppose that a source file has time interval 10:35:10 to 10:35:15 and the corresponding binary file has time interval 10:35:14 to 10:35:19. Is the binary file more recent? Probably, but not definitely. The only safe course of action for make is to recompile the source.
In general, when a program asks DTS to compare two times, there are three possible answers:
1. The first time is older.
2. The second time is older.
3. DTS cannot tell which is older.
Software using DTS has to be prepared to deal with all three possibilities. To provide backward compatibility with older software, DTS also supports a conventional interface with time represented as a single value, but using this value blindly may lead to errors.
DTS supports 33 calls (library procedures) relating to time. These calls are divided into the six groups listed in Fig. 10-16. We will now briefly mention these in turn. The first group gets the current time from DTS and returns it. The two procedures differ in how the time zone is handled. The second group handles time conversion between binary values, structured values, and ASCII values. The third group makes it possible to present two times as input and get back a time whose inaccuracy spans the full range of possible times. The fourth group compares two times, with or without using the inaccuracy part. The fifth group provides a way to add two times, subtract two times, multiply a relative time by a constant, and so on. The last group manages time zones.
Group | # Calls | Description |
---|---|---|
Retrieving times | 2 | Get the time |
Converting times | 18 | Binary-ASCII conversion |
Manipulating times | 3 | Interval arithmetic |
Comparing times | 2 | Compare two times |
Calculating times | 5 | Arithmetic operations on times |
Using time zones | 3 | Time zone management |
Fig. 10-16. Groups of time-related calls in DTS.
- Ограничение времени ожидания для транзакций (Lock timeout)
- DEADLOCK TIMEOUT
- CONNECTION TIMEOUT
- Timestamp request
- Chapter 2 Building and Deploying a Run-Time Image
- DiskExplorer от Runtime Software
- Time2Post
- B10. Функции даты и времени: ‹time.h›
- 11.7 Soft Timers and Timer Related Operations
- 1.1.4. Model Explorer - навигатор модели
- CHAPTER 7 Multimedia
- Setting the Time Zone