Why Time Difference Differs For The Same Application !?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • HTB
    New Member
    • Aug 2007
    • 13

    Why Time Difference Differs For The Same Application !?

    Hi,

    I have an application, I made a time difference (in millisecons)
    between two auto events within the application.

    I ran it twice, but the result (milliseconds) is not the same.

    WHY !?
  • kenobewan
    Recognized Expert Specialist
    • Dec 2006
    • 4871

    #2
    Curse you relativity! Was the first one slower?

    Comment

    • TRScheel
      Recognized Expert Contributor
      • Apr 2007
      • 638

      #3
      Originally posted by HTB
      Hi,

      I have an application, I made a time difference (in millisecons)
      between two auto events within the application.

      I ran it twice, but the result (milliseconds) is not the same.

      WHY !?
      You might want to read up on Chaos Theory.

      That and if you measure finely enough, you will note its never an identical span of time.

      Comment

      • HTB
        New Member
        • Aug 2007
        • 13

        #4
        At first it was samller, then it increased, after that it came back
        to the first value !


        OK, I read that, very interesting. But I have to ask why the
        milliseconds in DateTime have 7 digits, while I know
        they are 4 digits (1 second = 1000 milliseconds) !?

        Comment

        • TRScheel
          Recognized Expert Contributor
          • Apr 2007
          • 638

          #5
          Originally posted by HTB
          [OK, I read that, very interesting. But I have to ask why the
          milliseconds in DateTime have 7 digits, while I know
          they are 4 digits (1 second = 1000 milliseconds) !?
          You might want to know how many milliseconds total there are. If you want just the recent number, mod it by 1000.

          Comment

          • Plater
            Recognized Expert Expert
            • Apr 2007
            • 7872

            #6
            You are doing something like:
            Code:
            DateTime start= DateTime.Now;
            //do all that code stuff you want to measure
            TimeSpan t=(DateTime.Now-start);
            Right?
            I mean if you are doing any sort of I/O in your routine then it will never run the same time twice (well, depends on your precision)

            Comment

            Working...