Time interval

Discussion in 'Questions (Windows Mobile)' started by petrbury, Nov 5, 2009.

  1. petrbury

    petrbury Member Licensed User

    I have a problem with counting the time interval. I'm trying to count, how much time is between two events in my software, but I'm not succesful.
    For example in this code
       Time1 = 
       Time2 = 
       Ticks1 = TimeParse(Time1)
       Ticks2 = TimeParse(Time2)
       T = Ticks2 - Ticks1
       DeltaT = Time(T)
    the result is 12:00:06 and not 00:00:06 as I would expect.
    What am I doing wrong ?
    Thanks Petr.
  2. klaus

    klaus Expert Licensed User

    You must use 24 hours format:
    [FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]TimeFormat[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]([/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000]"HH:mm:ss"[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2])[/SIZE][/FONT][/SIZE][/FONT]
    instead of 12 hours format
    [FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]TimeFormat[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]([/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000]"hh:mm:ss"[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2])[/SIZE][/FONT][/SIZE][/FONT]
    In 12 hours format time begins with 12:00:00PM
    In 24 hours format time begins with 00:00:00

    Best regards.
  3. petrbury

    petrbury Member Licensed User

    Thank You very much, Klaus.
  4. agraham

    agraham Expert Licensed User

    You are specifying 12 hour time format. See Help -> Main Help -> Keywords -> Time -> TimeFormat.
  5. corwin42

    corwin42 Expert Licensed User

    Be aware that measuring time with b4ppc is very inaccurate on the device. If you want to measure intervals smaller than 1 second you should use GetTickCount from dzhw.library.

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice