64-bit unsigned variables are on the wish list already. I'll ask for a tick in your name to be added. Thanks!
------------------
Lance
PowerBASIC Support
mailto:[email protected][email protected]</A>
Announcement
Collapse
No announcement yet.
Unsigned Quads
Collapse
X
-
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:
Code:struct { DWORD LowPart LONG HiPart }LARGE_INTEGER
Code:struct { DWORD LowPart DWORD HiPart }ULARGE_INTEGER
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
Leave a comment:
-
Anything like this?
Code: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 Do 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 'ElseIf '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
Leave a comment:
-
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?
Thanks!
------------------
Mark NewmanTags: None
Leave a comment: