Results 1 to 4 of 4

Thread: Time and subtraction

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2001
    Location
    Denmark
    Posts
    1,049

    Question Time and subtraction

    I am testing performance and comparing time consumptions in Java and .net and for this I need to calculate in milliseconds. My timestamps are:

    time1 = Now.Hour & ":" & Now.Minute & ":" & Now.Second & ":" & Now.Millisecond

    when the calculation begins and

    time2 = Now.Hour & ":" & Now.Minute & ":" & Now.Second & ":" & Now.Millisecond

    How do I subtract the two times when I need milliseconds?

  2. #2
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949

    Re: Time and subtraction

    Originally posted by hpl
    I am testing performance and comparing time consumptions in Java and .net and for this I need to calculate in milliseconds. My timestamps are:

    time1 = Now.Hour & ":" & Now.Minute & ":" & Now.Second & ":" & Now.Millisecond

    when the calculation begins and

    time2 = Now.Hour & ":" & Now.Minute & ":" & Now.Second & ":" & Now.Millisecond

    How do I subtract the two times when I need milliseconds?
    Try

    VB Code:
    1. Dim Time1, time2 As DateTime
    2.         Dim icount, tCount As Integer
    3.         Time1 = Now
    4.         For icount = 1 To 10000
    5.             TextBox1.Text = Val(icount)
    6.         Next
    7.         time2 = Now
    8.         tCount = time2.Subtract(Time1).Milliseconds()
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2001
    Location
    Denmark
    Posts
    1,049
    Thanks a lot, it works fine!

  4. #4
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949
    Originally posted by hpl
    Thanks a lot, it works fine!
    You're welcome.

    Edit your first post and add "[Resolved]" to the thread title.
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width