9.9. Comparing and shifting times

| Chapter 9: Time |

| 9.9. Comparing and shifting times

Carrying out easy calculations with times is straightforward:

> The chronometer is in the Clock Chamber. "On one wall is a terribly self-important chronometer showing the time in major world cities. London: [time of day]. Paris: [one hour after the time of day]. Tokyo: [9 hours after the time of day]. Cupertino, California: [7 hours before the time of day]."

Here we are using two phrases:

(time) before (time) ... time

This phrase produces a time earlier by the amount given, keeping within the 24 hour clock. Example: 7 hours before 5:30 AM produces 10:30 PM.

(time) after (time) ... time

This phrase produces a time later by the amount given, keeping within the 24 hour clock. Example: 9 hours after 11 AM produces 8 PM.

Similarly, we have conditions:

if (time) is before (time):

This condition is true if the first time occurs earlier in the day than the second. In recognition of the fact that very few stories begin before 4 AM, whereas many run on past midnight, the start of the day is taken to be 4 AM: thus 3:59 AM is after 11:10 PM, but 4:04 AM is before it.

if (time) is after (time):

This condition is true if the first time occurs later in the day than the second. In recognition of the fact that very few stories begin before 4 AM, whereas many run on past midnight, the start of the day is taken to be 4 AM: thus 3:59 AM is after 11:10 PM, but 4:04 AM is before it.

| Previous builds of Inform allowed the following abbreviated forms, but they're being withdrawn in the interests of clarity: if it is before (time):
This condition is equivalent to: if the time of day is before (time) and is now deprecated: use the "time of day" wording instead.
if it is after (time):
This condition is equivalent to: if the time of day is after (time) and is now deprecated: use the "time of day" wording instead.

Previous | Contents | Next