• Welcome to Valhalla Legends Archive.
 

MBNCSUtil Filetime?

Started by Chriso, October 06, 2007, 05:08 AM

Previous topic - Next topic

Chriso

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.

MyndFyre

See: File.GetCreationTime() File.GetCreationTimeUtc(), File.GetLastWriteTime(), and File.GetLastWriteTimeUtc().  Then, refer to DateTime.ToFileTime() and DateTime.ToFileTimeUtc().
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

Chriso

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 :)

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!

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);
}


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.

Hdx

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

Proud host of the JBLS server www.JBLS.org.
JBLS.org Status:
JBLS/BNLS Server Status

Chriso

Yeah it has ReadInt64() as a method.
I have already changed to the answer that MyndFyre said above using DateTime.