TimeSpan results wrong data

Hi,

Got some issue with TimeSpan resulting in wrong duration for task.

For every 1 day we pass to the TimeSpan the resulted duration is 3 working days. And also for every 8 hours it converts into 1 day. Is there any way around if we want to use 24 hrs time span because we think aspose.tasks take 8 hrs as 1 day.
T1.Start = new DateTime(2015, 3, 9,8,0,0);
TaskLink t1_t2 = new TaskLink(T1, T2, TaskLinkType.FinishToStart);
Task1.Duration=new TimeSpan(0,6,24,0);
Task2.Duration=new TimeSpan(3,4,48,0);
Console.WriteLine(Task1.Name + " Start: " + Task1.Start);
Console.WriteLine(Task2.Name + " Finish: " + Task2.Finish);
//I am getting the Finish date of Task1 correct
//but for task2 its giving unexpected finish Date, in place of that we need finish date as (03/12/2015)
Whenever I'm trying to assign 3 days to task2 its taking as 9 days(3*24). And Aspose.Task a=considers
8hrs as 1 day. But as the TimeSpan returns 
Hi Nishanth,

Thank you for contacting Aspose support team.

You are right, when we set time span like TimeSpan(3,0,0,0), it will result in 9 days, because 1 day corresponds to 24 hours which is equal to 3 working days. If you want to set 3 days for Task2, please add working hours to hour part of TimeSpan as follows:

Task2.Duration = new TimeSpan(0,28,48,0); //24 + 4 hours

You may also please try the revamped Aspose.Tasks for .NET 8.0.0 which provides more flexibility as shown in the following sample code:
Project proj = new Project();
Task tsk = proj.RootTask.Children.Add("Task 01");
tsk.Set(Tsk.Start, new DateTime(2015, 3, 5, 8, 0, 0));
tsk.Set(Tsk.Duration, proj.GetDuration(3, TimeUnitType.Day));
proj.Save(dir + "SavedByTask.xml", SaveFileFormat.XML);

Hi Waqas,


I converted the days into total hours. And divided it by 3.
Now I can get the correct data.
T1.Duration = TimeSpan.FromHours(ConvertToTotalHours(1, 0, 0, 0));
And
public static Double ConvertToTotalHours(Double Days, Double Hours, Double Minutes, Double Seconds)
{
Double hours = (Days * 24) + (Minutes / 60) + (Seconds / 3600);
return (hours / 3) + Hours;
}

Hi,

Thank you for the feedback and please write to us for any further queries.