Timezones and client/server issue
807569Aug 28 2006 — edited Sep 14 2006We have a client process which runs on Windows PCs which are scattered among different timezones. These clients send data periodically to a server.
The data includes timestamps indicating when certain events happened on each client PC. We need to know the timezone for each PC so that we can display those timestamps (stored on the server in GMT) in the timezone of each PC.
The tricky bit: the clients are in C++ and the server is in Java. We cannot assume a JRE is installed on the clients.
Our C++ client code can get the Windows timezone name as a string and pass that to our Java server code. What isn't obvious is how to translate that string to a Java TimeZone object. For example, the Windows string "Central Standard Time" maps to the Java TimeZone ID String "America/Chicago".
I've done enough research to discover that the (relatively new) jre/lib/tzmappings file contains exactly these mappings. But it appears that the code which relies on that file is quite "under the hood" in java -- most likely in the unpublished sun.util.calendar package.
Does anyone know of a way to map an O/S-specific timezone string to a Java TimeZone object? I know I can write my own code to read the tzmappings file myself, but that file explicitly states that "No applications should depend on this file in any form." I'd prefer a kosher solution.
All ideas, suggestions, thoughts, links, etc. appreciated. Thank you!