More precision

The classes TIME and TIME_DURATION are designed to deal with time in high precision, limited only by platform numerical representation.

The classes TIME and TIME_DURATION have an attribute fine_second of type DOUBLE which allows high precision. This attribute represents the number of seconds with fractions. From fine_second are calculated the values for second and fractional_second. second is the truncated-to-integer part of fine_second and fractional_second is the fractional part of fine_second.

When fine_second is positive, 3.55 for example, second and fractional_second are both positive (3 and 0.55, respectively). When fine_second is negative (- 3.55 for example), then second and fractional_second are both 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, TIME_DURATION)

  • make_fine is similar to make except that it takes a DOUBLE for its third argument (instead of an INTEGER, as is the case with make). fine_second is then set to this value.
  • make_by_fine_seconds is similar to make_by_seconds except that it takes a DOUBLE for an argument (instead of an INTEGER, as is the case withmake_by_seconds).

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

  • Set fine_second directly with set_fine_second.
  • Set fractional_second directly with set_fractionals.

Note: Use of the feature set_second (in either TIME and TIME_DURATION) will result in fractional_second having a value of zero.

Operations

  • fine_second_add looks like second_add except that it takes a DOUBLE as an argument.