Bug: Possible TIMEDIFF error in Spreadsheet Plugin
TIMEDIFF gives false result if mixed with MAX/MIN of the dates
Test case
A table calculating workload distribution between months is built according to the following idea:
Jan Feb Mar Days in Jan Days in Feb Days in Mar
--------X--------X--------X--------X-------------X-------------X-------------X
Task 1 ----------------- (calculate) (calculate) (calculate)
Task 2 ----- (calculate) (calculate) (calculate)
Etc. (Gantt)
--------X--------X--------X--------X-------------X-------------X-------------X
Above calculation is performed using rather long formula giving the
set intersection of the worktime interval and full-month interval, i.e. TIMEDIFF(MAX(1 Jan, begin of task), MIN(31 Jan, end of task)) for January etc. Before this calculus, the codition is necessary throwing off the cases of work intervals not intersecting with particular full-month interval.
The resulting table looks as follows:
| Task |
Start |
Duration |
End |
Days in Aug |
Days in Sep |
Days in Oct |
Days in Nov |
| (Calibration) |
|
|
2004/08/01 |
2004/09/01 |
2004/10/01 |
2004/11/01 |
2004/12/01 |
| Task a |
2004/08/26 |
65 |
2004/10/30 |
6 |
30 |
29 |
nie |
| Task b |
2004/10/22 |
13 |
2004/11/03 |
nie |
nie |
10.0416666666667 |
2 |
| Task c |
2004/11/04 |
8 |
2004/11/12 |
nie |
nie |
nie |
8 |
| Task d |
2004/09/04 |
68 |
2004/11/10 |
nie |
27 |
31.0416666666667 |
9 |
| Task e |
2004/09/21 |
25 |
2004/10/16 |
nie |
10 |
15 |
nie |
Second row is for calibration: defining the end of particular month. The next day after the end of month is used in order to secure consistency with TIMEADD result.
You can see the error in Days in October if October is not last month. The difference is exactly 23 hours.
If the last day of month is used in the calibration, the error occurs in November.
Note: "nie" is Polish "no", indicating that there are no days of particular task in particular month.
Environment
| TWiki version: |
TWikiRelease01Sep2004 |
| TWiki plugins: |
DefaultPlugin, EmptyPlugin, InterwikiPlugin, TablePlugin, EditTablePlugin, CommentPlugin, HeadlinesPlugin, SpreadSheetPlugin, RenderListPlugin, TWikiDrawPlugin, SlideShowPlugin, SmiliesPlugin |
| Server OS: |
Win 2000, cygwin |
| Web server: |
Apache 1.3 |
| Perl version: |
|
| Client OS: |
Win 2000 |
| Web Browser: |
Mozilla Firefox 0.9 |
--
AndrzejGoralczyk - 16 Sep 2004
Follow up
Fix record