diff --git a/documentation/current/solutions/dates-and-times/eiffeltime/eiffeltime-tutorial/duration.wiki b/documentation/current/solutions/dates-and-times/eiffeltime/eiffeltime-tutorial/duration.wiki index 65b63be0..f90e7399 100644 --- a/documentation/current/solutions/dates-and-times/eiffeltime/eiffeltime-tutorial/duration.wiki +++ b/documentation/current/solutions/dates-and-times/eiffeltime/eiffeltime-tutorial/duration.wiki @@ -39,19 +39,19 @@ Two features ensure a link with the notion of ''day''. The first, to_day For example, the current duration is 25:70:600. to_days will return 1 (one day) and time_modulo_day will return 2:20:0:. If the current duration is negative: -23:-80:300, to_days will return -2 (minus two days) and time_modulo_day will return 23:45:0. -Durations may be canonical or not canonical (tested using the BOOLEAN query canonical). That means the features hour, minute, and second are included in a particular range, or not. An instance of TIME_DURATION is canonical if: +Durations may be canonical or not canonical. This can be tested using the BOOLEAN query canonical. Canonical form depends upon whether the features hour, minute, and second have values that fall in a particular range. An instance of TIME_DURATION is canonical if: * in the case of a positive duration (> zero), all of the three features have to be positive or 0, minute and second less than 60. -* in the case of a negative duration (< zero), all of the three features have to be negative or 0, minute and second strictly greater than -60. The function canonical tests if the duration is canonical or not, the function to_canonical yields a new duration equivalent to the current one and canonical. +* in the case of a negative duration (< zero), all of the three features have to be negative or 0, minute and second strictly greater than -60. The query canonical tests whether a duration is canonical. The query to_canonical yields a new, canonical TIME_DURATION equivalent to the query's target. ==DATE_DURATION== -Dealing with the Gregorian calendar is not so easy because of irregularities. A date duration of one month may be equal to 28 up to 31 days, depending on the current date! On the other hand, it could be useful to deal with precise duration. This issue leads to a unique point of design in the class: A separation is made between two kinds of instances: ''definite'' date durations and the ''relative'' date durations. The BOOLEAN query definite is true for definite durations and false otherwise. +DATE_DURATION is similar to TIME_DURATION, but models durations in dates rather than times. Dealing with the Gregorian calendar is not so easy because of its irregularities. A date duration of one month may be equal to 28, 29, 30, 31 days, depending on the current date! Sometimes though, it could be useful to deal with a precise date duration, just a number of days, independent of the current date. This issue leads to a unique point of design in the DATE_DURATION class: a separation is made between two kinds of instances: ''definite'' date durations and the ''relative'' date durations. The BOOLEAN query definite is True for definite date durations and false for relative date durations. An instance is ''definite'' if and only if its attributes month and year are 0. Then only the number of days is used. ''Relative'' (non-definite) durations allow their attributes year, month, and day to have meaningful values, but disallow comparisons with other durations, for reasons that will be explained below. -The distinction between definite and relative date duration makes a difference when a duration is added to a date. In the case of a definite duration, there is no ambiguity: a given number of days is added to the date. In the case of a relative date duration, the result is relative to the origin date. For example, a one month duration may be equal to 28 days if the date is in February or 31 days if the date is in August. A duration becomes definite when its attributes year and month become 0. However it is possible to deal with instances of DATE_DURATION without taking care of this distinction. +The distinction between definite and relative date duration makes a difference when a duration is added to a date. In the case of a definite DATE_DURATION, there is no ambiguity: a given number of days is added to the date. In the case of a relative DATE_DURATION, the result is relative to the duration's origin_date. For example, a one month duration may be equal to 28 days if the date is in February or 31 days if the date is in August. A duration becomes definite when its attributes year and month become 0. However it is possible to deal with instances of DATE_DURATION without taking care of this distinction. ===Relative DATE_DURATION=== @@ -67,7 +67,7 @@ A way to compare two relative durations is to make them canonical from the same ===Definite DATE_DURATION=== -Definite durations are characterized by the attribute day. Whenever a duration has its attributes year and month equal to 0, this duration is then definite. On the other hand, if one of these two attributes is not 0, the duration is not definite anymore. +Definite durations are characterized by the attribute day. Whenever a duration has its attributes year and month equal to 0, this duration is then definite. On the other hand, if one of these two attributes is not 0, the duration is relative. The number of days between an origin date and the result of (date + duration) does not depend on the origin date. It is possible to compare definite date_duration to each other.The order is the one of day.