More precision

TIME and TIME_DURATION are designed to deal with high precision in time. The only limit is the one from number representation.

The classes TIME and TIME_DURATION have an attribute fine_second (inherited from TIME_VALUE) which allows high precision. This attribute represents the number of seconds with fractions (it is an instance of DOUBLE). From this attribute are calculated second and fractional_second (which are functions): second is the truncated-to-integer part and fractional_second is the difference between the two previous one, so that the sum of second and fractional_second is always equal to fine_second (see invariant in TIME_VALUE).

As a result of this, when fine_second is positive (3.55 for example), second and fractional_second are also positive (3 and 0.55). When fine_second is negative (- 3.55 for example), second and fractional_second are also negative (- 3 and - 0.55).

Manipulation on second and fractional_second are in fact always made through fine_second. Users who do not want to deal with precision do not need to care about this.

Features dealing with fine_second and fractional_second are described here.

Creation (common to TIME and to TIME_DURATION)

Measurement and access

In TIME:

- fine_seconds looks like seconds but it contains fractions.

In TIME_DURATION:

- fine_seconds_count looks like seconds_count but it contains fractions.

Element change

The result of that would be fine_second = 3.2 (then second = 3 and fractional_second = 0.2). It is better to prohibit that.

Comment: feature set_second (from both TIME and TIME_DURATION) will cut down fractional_second to zero.

Operations

- fine_second_add looks like second_add but takes a DOUBLE for argument.

In TIME_DURATION:

- canonical and to_canonical deals already with precision. There is nothing different.