title: How to deal with Rounding-off TimeSpan?
body: <p>I take the difference between two DateTime fields, and store it in a TimeSpan variable, Now I have to round-off the TimeSpan by the following rules:</p>
  
  <p>if the minutes in TimeSpan is less than 30 then Minutes and Seconds must be set to zero,
  <br>if the minutes in TimeSpan is equal to or greater than 30 then hours must be incremented by 1 and Minutes and Seconds must be set to zero.</p>
  
  <p>TimeSpan can also be a negative value, so in that case I need to preserve the sign..</p>
  
  <p>I could be able to achieve the requirement if the TimeSpan wasn't a negative value, though I have written a code I am not happy with its inefficiency as it is more bulky ..</p>
  
  <p>Please suggest me a simpler and efficient method.</p>
  
  <p>Thanks regards,</p>
  
  <p>This is my code which works fine, when TimeSpan is not negative value ..</p>
  
  <pre><code>TimeSpan time_span = endTime.Subtract(startTime);
              TimeSpan time_span1;
              if (time_span.Minutes &gt;= 30)
              {
                  time_span1 = new TimeSpan(time_span.Hours + 1, 0, 0);
              }
              else
              {
                  time_span1 = new TimeSpan(time_span.Hours, 0, 0);
              }
  </code></pre>
  
  <p>time_span1 will contain the result ..</p>