Bug In System.TimeSpan Object?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Doug

    #1

    Bug In System.TimeSpan Object?

    Is it possible there is a bug with the System.TimeSpan object in .NET?
    I am using it to track times and am seeing an unusual situation.

    From what I understand, there are 1000 milliseconds in a second. I
    have a test I ran using the TimeSpan object which when I use
    TimeSpan.Millis econds I got 658 but if I use TimeSpan.Second s I get 5.

    If it took 658 milliseconds that should be less than 1 second right?
    658 milliseconds should not convert to 5 seconds should it?
  • John Vottero

    #2
    Re: Bug In System.TimeSpan Object?

    "Doug" <dnlwhite@dtgne t.com> wrote in message
    news:ff7d6992.0 311251120.24ad6 f34@posting.goo gle.com...[color=blue]
    > Is it possible there is a bug with the System.TimeSpan object in .NET?
    > I am using it to track times and am seeing an unusual situation.
    >
    > From what I understand, there are 1000 milliseconds in a second. I
    > have a test I ran using the TimeSpan object which when I use
    > TimeSpan.Millis econds I got 658 but if I use TimeSpan.Second s I get 5.
    >
    > If it took 658 milliseconds that should be less than 1 second right?
    > 658 milliseconds should not convert to 5 seconds should it?[/color]

    You are confusing TimeSpan.Millis econds and TimeSpan.TotalM illiseconds. If
    your time span was 5.658 seconds long, then:

    TimeSpan.Second s = 5
    TimeSpan.Millis econds = 658
    TimeSpan.TotalM illiseconds = 5658



    Comment

    Working...