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 tomake
except that it takes aDOUBLE
for its third argument (instead of anINTEGER
, as is the case withmake
).fine_second
is then set to this value. -
make_by_fine_seconds
is similar tomake_by_seconds
except that it takes aDOUBLE
for an argument (instead of anINTEGER
, 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 likeseconds_count
but it contains fractions.
Element change
- Set
fine_second
directly withset_fine_second
. - Set
fractional_second
directly withset_fractionals
.
Operations
-
fine_second_add
looks likesecond_add
except that it takes aDOUBLE
as an argument.