Joda time (1.6)ライブラリを使用していますが、GMTではなくBritishSummerTimeという間違ったタイムゾーンのDateTimeオブジェクトが返され続けます。
私のWindowsワークステーション(JDK 1.6.0_16を実行)はGMTであると見なし、JDKの日付/時刻クラスからデフォルトのタイムゾーンを取得した場合、それは正しい(GMT)です。Linuxサーバーでも同じ動作がします。Jodaのタイムゾーンデータベースファイルでエラーが発生している可能性があると考えたため、最新のデータベースを使用してjarを再構築しましたが、変更はありませんでした。
import java.util.TimeZone;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
import org.joda.time.LocalTime;
import org.joda.time.format.DateTimeFormatter;
import org.joda.time.format.ISODateTimeFormat;
public class TimeZoneTest {
public static void main(String[] args) {
DateTimeFormatter timeParser = ISODateTimeFormat.timeParser();
TimeZone timeZone = TimeZone.getDefault();
System.out.println(timeZone.getID()); // "Europe/London"
System.out.println(timeZone.getDisplayName()); // "Greenwich Mean Time"
DateTimeZone defaultTimeZone = DateTimeZone.getDefault();
System.out.println(defaultTimeZone.getID()); //"Europe/London"
System.out.println(defaultTimeZone.getName(0L)); //"British Summer Time"
DateTime currentTime = new DateTime();
DateTimeZone currentZone = currentTime.getZone();
System.out.println(currentZone.getID()); //"Europe/London"
System.out.println(currentZone.getName(0L)); //"British Summer Time"
}
}
の静的イニシャライザーを介してデバッグすると、呼び出しが期待どおりに行われるorg.joda.time.DateTimeZone
ことがわかります。System.getProperty("user.timezone")
"Europe/London"