[DB-SIG] ODMG Date/time classes
Jeffrey C. Jacobs
timehorse@unforgettable.com
Thu, 18 Dec 1997 18:03:31 -0500
-----Original Message-----
From: Magnus Lycka [SMTP:magnus.lycka@tripnet.se]
Sent: Thursday, December 18, 1997 5:22 PM
To: Jeffrey C. Jacobs; 'The Python DataBase Sig'
Subject: RE: [DB-SIG] ODMG Date/time classes
Jeffrey C. Jacobs wrote:
>Specifically,
>
> "(130 sec) % (1 min)" =3D>
> "(130 sec) % 60" =3D>
> "10 sec".
But what about "(5 days) % (2 integer)" ? It seems intuitive that the =
'unit'
here would be 'days', but what we are doing is just (432000 sec) % (2 =
integer)
which is not 2 days, but 2.5 days.
[The TimeHorse] Ah, ha!! I see your point! That is very well =
observed,
and since the second itself is a floating point value, the true =
remainder
of say "(1 sec) / 3" would be 0.000000000001 sec, which really is
negligible. Thus, for TimeSpan values, we can always divide to a
reasonably good precision. Really small TimeSpans would still be
problematic because of the remainder being so large relative to the
division result, but in most cases, the TimeSpan will be so large that =
the
error on division will be negligible compared to the result. The only
time this might be a problem is if we define a TimeSpan as being a =
series
of distinct fields, such as months, days and years. I still think that
the pure TimeSpan object should be an absolute time similar to the
DateTime object, with the two, Day and SecondsSinceMidnight, fields, and
thus can again be divided to relatively infinite precision. The only =
time we would worry about the Modulo is when we deal with an object that =
we
want quantized to some unit, say such as months. Again, this is a
question of TimeSpan implementation, and if we support the addition of
months, then we also must somehow encode what our unit of quantization =
is
for the modulo arithmetic. Otherwise, with TimeSpans of floating-point
precision, the modulo should always return "0 sec", or at most some very
small error precision value, like +/- 0.000000000001 sec.
Be Seeing You,
Jeffrey.
---
~,-;` The TimeHorse
Sometimes also a Dragon. . .
_______________
DB-SIG - SIG on Tabular Databases in Python
send messages to: db-sig@python.org
administrivia to: db-sig-request@python.org
_______________