Valhalla Legends Forums Archive | .NET Platform | MBNCSUtil Filetime?

AuthorMessageTime
DDA-TriCk-E
I was just curious whether DataReader has a function to read FILETIME structures, apart from using ReadByteArray?  What is the best way to the MPQFiletime from SID_AUTH_INFO response?

Cheers.
October 6, 2007, 10:08 AM
Myndfyr
See: File.GetCreationTime() File.GetCreationTimeUtc(), File.GetLastWriteTime(), and File.GetLastWriteTimeUtc().  Then, refer to DateTime.ToFileTime() and DateTime.ToFileTimeUtc().
October 6, 2007, 7:22 PM
DDA-TriCk-E
Thanks, i was just curious.  I think I'll just use the GetByteArray for MPQFiletime, since I am just echoing it to BNLS at this time.  But thanks for the references they will come in handy later on :)
October 6, 2007, 8:10 PM
Camel
I did the same thing, except I figured out how to convert the FileTime to a Java Date before I realized I didn't need to!

[code] public static Date fileTime(long ft) {
// Contains a 64-bit value representing the number of 100-nanosecond intervals since January 1, 1601 (UTC).
return new Date(ft / 10000 - 11644455600000L);
}[/code]

Note that 11644455600000L==Date.parse("1/1/1601").getTime(), and 1ms/100ns==10000.

If C#'s dates don't work identically, you should be able to figure it out using the same strategy I used: divide the rate at which its timer intervals by 100 nanoseconds and use the quotient as the number you divide the FileTime by. Then, subtract the number of intervals required to represent "Jan 1 1601."

Hope this helps.
October 7, 2007, 7:56 AM
HdxBmx27
Yes you could use getbytearray, but its more of a standard to treat a filetime struct as 2 32-bit integers.
But! If your language can handle it (I think) MBNCSutil.dll has a way to extract 64-bit integers.
~Hdx
October 8, 2007, 2:12 PM
DDA-TriCk-E
Yeah it has ReadInt64() as a method.
I have already changed to the answer that MyndFyre said above using DateTime.
October 9, 2007, 8:38 AM

Search