Valhalla Legends Forums Archive | Java Programming | [0x50] TZ bias, et al

AuthorMessageTime
Camel
Anybody know how to determine TZ bias, LocaleID, LanguageID, Country abbreviation, and Country in Java?

[code] p = new BNCSPacket(BNCSCommandIDs.SID_AUTH_INFO);
p.writeDWord(0); // Protocol ID (0)
p.writeDWord(PlatformIDs.PLATFORM_IX86); // Platform ID (IX86)
p.writeDWord(productID); // Product ID
p.writeDWord(verByte); // Version byte
p.writeDWord("enUS"); // Product language
p.writeDWord(0); // Local IP
p.writeDWord(0xf0); // TZ bias
p.writeDWord(0x409); // Locale ID
p.writeDWord(0x409); // Language ID
p.writeNTString("USA"); // Country abreviation
p.writeNTString("United States"); // Country
p.SendPacket(dos, cs.packetLog);
break;[/code]
August 21, 2007, 2:47 PM
rabbit
Not sure if it covers everything, but clicky.
August 21, 2007, 3:48 PM
Camel
Thanks for the pointer. Got all but locale id/language id so far.

[code]Locale loc = Locale.getDefault();
String prodLang = loc.getLanguage() + loc.getCountry();
int tzBias = TimeZone.getDefault().getOffset(new Date().getTime()) / -60000;
Out.info(this.getClass(), "tzBias=" + tzBias);


p = new BNCSPacket(BNCSCommandIDs.SID_AUTH_INFO);
p.writeDWord(0); // Protocol ID (0)
p.writeDWord(PlatformIDs.PLATFORM_IX86); // Platform ID (IX86)
p.writeDWord(productID); // Product ID
p.writeDWord(verByte); // Version byte
p.writeDWord(prodLang); // Product language
p.writeDWord(0); // Local IP
p.writeDWord(tzBias); // TZ bias
p.writeDWord(0x409); // Locale ID
p.writeDWord(0x409); // Language ID
p.writeNTString(loc.getISO3Country()); // Country abreviation
p.writeNTString(loc.getDisplayCountry()); // Country
p.SendPacket(dos, cs.packetLog);[/code]
August 21, 2007, 4:05 PM
DDA-TriCk-E
Don't know if this will help but it shows you how to use the TimeZone class:
http://java.sun.com/developer/JDCTechTips/2003/tt1104.html#2
August 23, 2007, 11:45 PM

Search