Chapter 48. What’s the Time?
Nikhil Nanivadekar
Time is “the indefinite continued progress of existence and events that occur in an apparently irreversible succession from the past, through the present, into the future,” according to Wikipedia. From a computing perspective, time can be a duration, or a date-time representation. Why is time an interesting problem in the field of computing?
Consider a day: each day has 24 hours, each hour has 60 minutes, each minute has 60 seconds, and each second has 1,000 milliseconds. Hence, questions like “How long did a process take?” or “How much time does it take to complete a task?” deal with duration. Duration can be computed by using this formula:
Now let’s look at time as a date-time representation. The representation consists of year, month, day, hour, minute, second. Using an ISO 8601 standard, time can be represented as a value like 2020-06-10T00:51:23Z, where Z denotes the time zone—in this case, Coordinated Universal Time (UTC).
Reconsider the preceding formula for duration; the seemingly straightforward formula becomes a little more complicated because of the time zones involved. For example, say a process is started by a user in India at 08:00 local time and completed by another user in New York at 08:00 local time. The preceding formula would indicate the process took 0 minutes. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access