From: SourceForge.net <no...@so...> - 2005-05-22 19:07:04
|
Bugs item #1162885, was opened at 2005-03-14 11:36 Message generated for change (Settings changed) made by rrokytskyy You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=109028&aid=1162885&group_id=9028 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. >Category: None >Group: None Status: Open Resolution: None Priority: 5 Submitted By: Platypus (erikolofsson) Assigned to: Roman Rokytskyy (rrokytskyy) Summary: Date, Time and Timestamp created in wrong TimeZone Initial Comment: XQSLVAR uses the current timezone setting in the client when converting Date, Time and Timestamp data. This behaviour is clearly wrong as it ignores daylight savings and GMT offset. The following code demonstrates the bug. (I'm running CET = GMT+1 with DST) import java.sql.Timestamp; import org.firebirdsql.gds.XSQLVAR; public class XSQLVAR_TimeZoneBug { public static void main( String[] ignored ) { XSQLVAR xsql = new XSQLVAR(); Timestamp ts = new Timestamp( 0 ); Timestamp ts2; // Loop over one year from now // we will both enter and leave DST (Day Light Savings) long time = System.currentTimeMillis(); for ( int i=0; i<365*24; i++ ) { // Advance one hour time += 3600000; ts.setTime( time ); byte[] bytes = xsql.encodeTimestamp( ts ); ts2 = xsql.decodeTimestamp( bytes ); // The two timestaps should point to the same point in time. // getTime() returns the number of milliseconds since // January 1, 1970, 00:00:00 GMT. if ( ts.getTime() != ts2.getTime()) { System.err.println( "Timestamps differ!" ); System.err.println( "Timestamp 1: "+ts ); System.err.println( "Timestamp 1 (ms): "+ts.getTime()); System.err.println( "Timestamp 2: "+ts2 ); System.err.println( "Timestamp 2 (ms): "+ts2.getTime()); System.err.println( "diff (ms) : "+(ts2.getTime()-ts.getTime())); return; } } System.err.println( "OK" ); } } ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=109028&aid=1162885&group_id=9028 |