differences between two timespan returns negative
<p>I am in a HR project and I need to define Shift for Employees 
Shift had two feilds for punchcards reading , Swipein and swipeOut . I use two datetimepicker with format as time and showupdown as true to set the swipe in and out time 
and read like this </p>

<pre><code>public void calculateduration()
    {
        TimeSpan swipein = dtp_toTime.Value.TimeOfDay;
        TimeSpan swipeout = dtp_FromTime.Value.TimeOfDay;
        TimeSpan duration = dtp_toTime.Value.TimeOfDay - dtp_FromTime.Value.TimeOfDay;
        MessageBox.Show(duration.ToString());

    }
</code></pre>

<p>in my SQL server database I had all these three feilds swipein ,swipeout,duration as Time datatype ,and I want to insert these values there</p>

<p>For testing I give four values </p>

<p>Swipein     Swipeout        Duration(output displayed)
8 am        4 pm           8 hrs >>>>its same day sday shift</p>

<p>3 pm       10 pm           8 hrs >> same day daynight shifty</p>

<p>10 pm   6 am(next day)    -16 hrs >>> the prblm..8 must come here</p>

<p>Any Idea pls
or can any one tell me an idea to check whether the duration recieved is negative like </p>

<pre><code>if(duration &lt;0)
{
duration= 24-duration;
} 
</code></pre>
