Announcement

Collapse
No announcement yet.

GetCurrentTime ???

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Michael Rosner
    replied
    Hello...

    Tank you all for your help.
    The "GetTickCounter" was exactly what i was looking for.
    Now it works fine..

    Best regards..Michael Rosner

    ------------------


    [This message has been edited by Michael Rosner (edited July 09, 2000).]

    Leave a comment:


  • Fred Oxenby
    replied
    If I had read your message carefully, I'ld have seen that you use
    GetMessageTime api-call.
    If you look this message up in MSDN (or help) you will find that
    GetTickCount is the way to do it.



    ------------------
    Fred
    mailto:[email protected][email protected]</A>
    http://www.oxenby.se

    Leave a comment:


  • Fred Oxenby
    replied
    The time-member in MSG-structure is in DWORD format.
    This indicate that the MSG.time is the elapsed time in milliseconds since
    Windows was restarted. After 47.9 days (approx) this will wrap around and start at zero again.
    You would use GetTickCount to get the "current time" in milliseconds
    Code:
     %Time_Limit = 5000  '( 5000 milliseconds)
     dwNow = GetTickCount
     If dwNow < MSG.time then
      ..Calculate new time as wraparound has accured
     Else
      If (dwNow - MSG.time) > %Time_limit Then
       .. take timed_out action
      Else
       .. take other action 
      End if
     End if

    ------------------
    Fred
    mailto:[email protected][email protected]</A>
    http://www.oxenby.se

    Leave a comment:


  • Edwin Knoppert
    replied
    Time$ ?


    ------------------
    [email protected]

    Leave a comment:


  • Scott Turchin
    replied
    You want that in SYSTEMTIME structure?

    Now you have a systemtime structure.

    But for what you are doing, you may want something a bit more accurate:
    You may have to peel this code apart a bit but it should server your purpose in nanoseconds.


    Thanks to a lot of people for this help when I needed it:
    I'm just generating this as I go along, so please debug.

    Code:
    Union QuadFILETIME
      dwLowDateTime  As Dword
      dwHighDateTime As Dword
      qdTime         As Quad
    End Union   
    '
    '
    '
    Function IsTimeGreaterThan(ot as SYSTEMTIME) As Long
    'ot will be the systemtime of the time the message came in ??
    'If so we can just compare to current time.
    
    Dim QT          As QuadFILETIME
    Dim QT2         As QuadFILETIME
    Dim st          As SYSTEMTIME
    
    GetSystemTime st   'GMT Time! Current time
    
    '
    'Convert to QUAD time
    SystemTimeToFileTime ST,QT
    SystemTimeToFileTime ot,QT2
    If QT > QT2 Then
        MsgBox "The current time is greater than the message time"
    End If
    End Function

    ------------------
    Scott
    mailto:[email protected][email protected]</A>
    MCSE, MCP+Internet

    Leave a comment:


  • Semen Matusovski
    replied
    GetCurrentTime was in 16-bit versions of Windows and was replaced by GetTickCount.
    But better to use QueryPerformanceFrequency / QueryPerformanceCounter
    (search BBS by these words; there are samples)


    ------------------

    Leave a comment:


  • Michael Rosner
    started a topic GetCurrentTime ???

    GetCurrentTime ???

    Hello...
    I am Using PBDLL.50 and i like to eliminate unwanted messages from the message queue by comparing GetMessageTime with the current time.
    Charles Petzold's GetCurrentTime doesn't work !
    I neeed to know the current system time!..who can help..it is important for me..

    Thanks..Michael



    [This message has been edited by Michael Rosner (edited July 08, 2000).]
Working...
X