No announcement yet.

Unsigned Quads

  • Filter
  • Time
  • Show
Clear All
new posts

  • Unsigned Quads

    Are unsigned Quads on the wish list? I see that 8-byte signed & unsigned
    integer types are appearing in various Windows header files (maybe they've
    been there a while) though usually via a structure of two 4-byte types.

    On a related note, are the new 64-bit processors and operating systems
    introducing any new fundamental data types or are the 8-byte integers
    about it?


    Mark Newman
    Mark Newman

  • #2
    Anything like this?

    Union QuadFILETIME
      dwLowDateTime  As Dword
      dwHighDateTime As Dword
      qdTime         As Quad
    End Union
    'Function CheckAtomicTime(lserv As String,wPort As Long,aTimeOut As Long,Delay As Double, st As SYSTEMTIME) Export As String
    Local buffer    As String
    Local lpbuf     As String
    Local UTCTime   As String
    Local vbdate    As Double
    Dim Start       As Dword
    Dim Stopp       As Dword
    Dim QT          As QuadFILETIME
    Dim Pc          As Long
    Pc& = SetPriorityClass(GetCurrentProcess(), %HIGH_PRIORITY_CLASS)
    lserv = Extract$(Ltrim$(lserv), Any " (")
    '51468 99-10-17 05:12:27 15 0 0 888.6 UTC(NIST) *
    'Record your starttime In milliseconds
    Start = TimeGetTime()
    Tcp Open Port wPort At lserv As #hTcp TIMEOUT aTimeOut
      Tcp Recv #hTcp, 1600, buffer
      lpbuf = lpbuf + buffer
    Loop While Len(buffer)
    Tcp Close #hTcp
    lpbuf = Trim$(lpbuf, $LF)
    Replace $LF With $CRLF In lpbuf
    UTCTime = Trim$(lpbuf, $LF)
    Function = UTCTime
    Delay = TimeGetTime - Delay
    'vbDate = StrToVbDate(Parse$(UTCTime, Any " ",2) + " " + Parse$(UTCTime, Any " ",3))
    'VariantTimeToSystemTime vbDate, st
    Stopp = TimeGetTime()
    'Convert your Atomic time into a SYSTEMTIME structure ST
    'FILETIME returns 100's of NANOSECONDS so you have to adjust
    'Delay To reflect this resulotion
    Delay = (Stopp - Start)* 10000
    'NIST TIME SERVER (Nuclear)
    '51468 99-10-17 05:12:27 15 0 0 888.6 UTC(NIST) *
    If Right$(UTCTime,2) = "* " Then
       Local UTCDate As String
       Local UTCTimeOnly As String
       UTCDate = Parse$(UTCTime, Any " ",2)
       UTCTimeOnly = Parse$(UTCTime, Any " ",3)
        ' Convert date and time to a SYSTEMTIME structure using a date VARIANT
        vbDate = StrToVbDate(UTCDate + " " + UTCTimeOnly)
        VariantTimeToSystemTime vbDate, st
    ElseIf Len(UTCTime) = 5 Then
         RFC868toSystemTime CvDwd(UTCTime), st
       'Internet Time Server
       '"Wed, 13 Oct 1999 15:07:52 -0700"
    ElseIf Len(UTCTime) < 2 Then
        Function = Date$ + " DEBUG:"
        Exit Function
    End If
    'convert your Atomic time In ST To FileTime In QT
    SystemTimeToFileTime ST,QT
    'Now Add the delay To the Quad-element that overlay the FILETIME-struct
    QT.qdTime = (QT.qdTime + Delay) - 50000 'subtract 50ms NIST network delay
    'Convert back To SYSTEMTIME
    FileTimeToSystemTime QT,ST
    Delay = Delay \ 10000
    End Function
    Scott Turchin
    True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi


    • #3
      What I saw was the variable type LARGE_INTEGER while porting parts of WINIOCTL.H to PB format.
      I searched the Win header files and found something similar to this:
         DWORD LowPart
         LONG  HiPart
      which seems the same as a PB Quad, a signed 8-byte integer. There's also an unsigned version:
         DWORD LowPart
         DWORD HiPart
      Actually, I found different implementations of this in several different header files,
      depending on some #ifdefs and such.

      Anyway, I was just suggesting that unsigned Quads be added to the wish list, along
      with any new native 64-bit data types. It's not a big deal to use a TYPE or UNION for
      this, just that a native PB type would be easier!

      Mark Newman
      Mark Newman


      • #4
        64-bit unsigned variables are on the wish list already. I'll ask for a tick in your name to be added. Thanks!

        PowerBASIC Support
        mailto:[email protected][email protected]</A>
        mailto:[email protected]