I'm using DateTime C#. I have an XML file with attribute HOUR, i.e:
<MyXML>
<LastTimeTaskRun>11:50</LastTimeTaskRun>
</MyXML>
And i have a task that running each 5 min. I want to know if the current time and the hour from the xml big then 5 min. What I'm trying:
int hour, min;
DateTime dateTimeXML = DateTime.Now, dateTimeNow;
string [] lastSuccessTime = LastSuccessTime.Split(':');
Int32.TryParse(lastSuccessTime[0], out hour);
Int32.TryParse(lastSuccessTime[1], out min);
dateTimeXML = dateTimeXML.Date + new TimeSpan(hour, min, 0);
dateTimeNow = DateTime.Now;
bool isBigThen5Min = (dateTimeNow - dateTimeXML).TotalMinutes > 5;
The code is works fine, but i want to know what is the best way (performance) to do that.
Thanks