Valhalla Legends Forums Archive | Battle.net Bot Development | Question

AuthorMessageTime
DarkOne
When performing a complete packet parse and retreiving the following:

Normal:
Record\SEXP\0\last game
Record\SEXP\0\last game result

Ladder:
Record\SEXP\1\last game
Record\SEXP\1\last game result

How do I convert the integer values recieved into the integer values used in showing the date and time of the last win, loss or draw?

For example:

NORMAL
WIN at 29556287 1363496298
WIN at 4/8/2003 22:25

If anyone can enlighten me, I'd appreciate it.
April 28, 2003, 3:17 AM
Skywing
[quote author=DarkOne link=board=17;threadid=1170;start=0#msg8653 date=1051499865]
When performing a complete packet parse and retreiving the following:

Normal:
Record\SEXP\0\last game
Record\SEXP\0\last game result

Ladder:
Record\SEXP\1\last game
Record\SEXP\1\last game result

How do I convert the integer values recieved into the integer values used in showing the date and time of the last win, loss or draw?

For example:

NORMAL
WIN at 29556287 1363496298
WIN at 4/8/2003 22:25

If anyone can enlighten me, I'd appreciate it.
[/quote]These are the two members of a FILETIME structure. The above link also includes suggestions on how to display such a structure in an easily understandable format.
April 28, 2003, 3:30 AM
Camel
if you're using vb, use this:
[code]Public Function FTtoDate(str As String) As Date
Dim D As Currency
CopyMemory D, ByVal str, 8

Const DateDiff = -109205 '"Win32 day 0;" CDbl(#1/1/1601#)
Const TicksPerDay = 86400000# '60 * 60 * 24 * 1000

On Error Resume Next
FTtoDate = CDate(D / TicksPerDay + DateDiff)
If ERR Then Debug.Assert False
End Function[/code]

that function expects the filetime as a stringamized qword, but you could easily adapt it
btw, currency is only used because it's 64bit
April 29, 2003, 2:39 AM
Camel
[quote author=Maddox link=board=17;threadid=1170;start=0#msg8764 date=1051596303]
I suggest using FileTimeToLocalFileTime() then FileTimeToSystemTime().
[/quote]

my code is much shorter and more simple ;)
April 29, 2003, 8:04 PM
Skywing
[quote author=Camel link=board=17;threadid=1170;start=0#msg8788 date=1051646657]
[quote author=Maddox link=board=17;threadid=1170;start=0#msg8764 date=1051596303]
I suggest using FileTimeToLocalFileTime() then FileTimeToSystemTime().
[/quote]

my code is much shorter and more simple ;)
[/quote]Not really. You still have to parse it out into days, hours, minutes, and so on with your method if you don't want to use the CDate format. The SYSTEMTIME functions do this for you - and leave how exactly to present the information up to you.
April 29, 2003, 8:33 PM
Camel
[quote author=Skywing link=board=17;threadid=1170;start=0#msg8795 date=1051648399]
[quote author=Camel link=board=17;threadid=1170;start=0#msg8788 date=1051646657]
[quote author=Maddox link=board=17;threadid=1170;start=0#msg8764 date=1051596303]
I suggest using FileTimeToLocalFileTime() then FileTimeToSystemTime().
[/quote]

my code is much shorter and more simple ;)
[/quote]Not really. You still have to parse it out into days, hours, minutes, and so on with your method if you don't want to use the CDate format. The SYSTEMTIME functions do this for you - and leave how exactly to present the information up to you.
[/quote]

what's wrong with CDate?

[edit] and, skywing, my function returns a vb Date, meaning you can display it however you want.
April 29, 2003, 8:44 PM
Yoni
You can display a SYSTEMTIME however you want, as well.
May 1, 2003, 2:40 PM
Camel
but it's far more practical in vb to use a Date
May 4, 2003, 2:13 AM

Search