[MNG-5648] Regression of MNG-5176, DST in effect is ignored

This commit is contained in:
Michael Osipov 2014-06-15 18:59:28 +02:00
parent bd2b01d4ea
commit 5c78a8d2fa
1 changed files with 5 additions and 0 deletions

View File

@ -21,6 +21,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.util.Date;
import java.util.Locale;
import java.util.Properties;
import java.util.TimeZone;
@ -153,6 +154,10 @@ public static String formatTimestamp( long timestamp )
TimeZone tz = TimeZone.getDefault();
int offset = tz.getRawOffset();
// Raw offset ignores DST, so check if we are in DST now and add the offset
if( tz.inDaylightTime( new Date( timestamp ) ) )
offset += tz.getDSTSavings();
long m = Math.abs( ( offset / ONE_MINUTE ) % 60 );
long h = Math.abs( ( offset / ONE_HOUR ) % 24 );