Message571
Logged In: NO
Here is the spec I have been noodling with feel free to tell me
what is
missing or what I haven't thought of. Algebra is but a
distant memory
to me at this point.
'I' stands for interval 'N' stands for number (real
or integer),
'D' stands for date. -> is read as creates. The number is
just
an instance specifier I1 - I2 interval 1 minus interval 2
etc.
The interval package should support the following
operations
and use cases:
I1 + I2 -> I3 - add two intervals
I1 - I2 -> I3 - subtract two intervals if I1 > I2 the result is
a positive interval
that will result in a future
time when added to a date. Otherwise the
result is a negative interval that will result
in a time in the past when
added to a date.
Also, (I1 - I2) + (I2 - I1) = 0 should be true.
I * N -> I -
multiple an interval by a number. I expect this
to take 14 hours and 10
minutes. so I can do
4 of them in 4*(14:10)
I / N -> I - divide an
interval by a number. The average
time it took to do this was
(I1+I2+i3+I4)/4.
I1/I2 -> N - Division of two intervals. Used for
calculating
percentage of time in a given state. E.G. I1 is
the
amount of time in the open state. I2 is
the amount of time it was in the
open and
testing states. The ratio gives us the amount of
time
spend working compared to time to close.
D + I -> D what date time
is it in 1 day 4 hours
D - I -> D what date was it 1 day and 4 hours ago
Also D + (-I) = D - I. where -I is a negative
interval.
I claim that only
I+I should be supported for intervals that
include months since there
is a fixed number of months per
year and we can round up. If we can use
some heuristic to
allow carrying from a month into days, then I -I and
other
operations are allowed.
If we can live with this
restriction, then the date math needs
to be able to produce the
difference of two dates without the
months component using days
instead, which should be
doable since there is a fixed number of days
between any
two dates.
-- rouilj |
|
Date |
User |
Action |
Args |
2009-02-03 14:20:11 | admin | link | issue665357 messages |
2009-02-03 14:20:11 | admin | create | |
|