Index: test/java/quickfix/SessionScheduleTest.java
===================================================================
--- test/java/quickfix/SessionScheduleTest.java	(Revision 1110)
+++ test/java/quickfix/SessionScheduleTest.java	(Arbeitskopie)
@@ -50,6 +50,7 @@
         super.tearDown();
     }
 
+    
     public void testSessionAlwaysActive() throws Exception {
         Calendar start = getUtcTime(0, 0, 0);
         Calendar end = getUtcTime(0, 0, 0);
@@ -145,7 +146,7 @@
         SessionSchedule schedule = new SessionSchedule(settings, sessionID);
         assertEquals("schedule is wrong", expectedInSession, schedule.isSessionTime());
     }
-
+//
     private void doIsSessionTimeTest(SessionSettings settings, SessionID sessionID,
             boolean expectedInSession, int year, int month, int day, int hour, int minute,
             int second, String timeZoneID) throws ConfigError, FieldConvertError {
@@ -670,6 +671,103 @@
         doWeeklyIsSameSessionTest(DayConverter.toString(Calendar.WEDNESDAY), "14:00:00", DayConverter.toString(Calendar.FRIDAY), "12:00:00");
         doWeeklyIsSameSessionTest(DayConverter.toString(Calendar.FRIDAY), "14:00:00", DayConverter.toString(Calendar.FRIDAY), "13:59:00");
     }
+    
+    public void testSettingsWithDST() throws Exception {
+    	SessionSettings settings = new SessionSettings();
+        settings.setString(Session.SETTING_TIMEZONE, "Europe/Zurich");
+        settings.setString(Session.SETTING_START_TIME, "01:30:00");
+        settings.setString(Session.SETTING_END_TIME, "03:15:00");
+        SessionID sessionID = new SessionID("FIX.4.2", "SENDER", "TARGET");
+        //
+        SessionSchedule schedule = new SessionSchedule(settings, sessionID);
+		doIsSessionTimeTest(schedule, false, 2012, Calendar.OCTOBER, 20, 01, 29, 0, TimeZone.getTimeZone("Europe/Zurich"));
+		doIsSessionTimeTest(schedule, true, 2012, Calendar.OCTOBER, 20, 01, 31, 0, TimeZone.getTimeZone("Europe/Zurich"));
+		doIsSessionTimeTest(schedule, true, 2012, Calendar.OCTOBER, 20, 02, 16, 0, TimeZone.getTimeZone("Europe/Zurich"));
+		doIsSessionTimeTest(schedule, true, 2012, Calendar.OCTOBER, 20, 03, 14, 0, TimeZone.getTimeZone("Europe/Zurich"));
+		doIsSessionTimeTest(schedule, false, 2012, Calendar.OCTOBER, 20, 03, 16, 0, TimeZone.getTimeZone("Europe/Zurich"));
+		//
+        schedule = new SessionSchedule(settings, sessionID);
+		doIsSessionTimeTest(schedule, false, 2012, Calendar.OCTOBER, 27, 01, 29, 0, TimeZone.getTimeZone("Europe/Zurich"));
+		doIsSessionTimeTest(schedule, true, 2012, Calendar.OCTOBER, 27, 01, 31, 0, TimeZone.getTimeZone("Europe/Zurich"));
+		doIsSessionTimeTest(schedule, true, 2012, Calendar.OCTOBER, 27, 02, 16, 0, TimeZone.getTimeZone("Europe/Zurich"));
+		doIsSessionTimeTest(schedule, true, 2012, Calendar.OCTOBER, 27, 03, 14, 0, TimeZone.getTimeZone("Europe/Zurich"));
+		doIsSessionTimeTest(schedule, false, 2012, Calendar.OCTOBER, 27, 03, 16, 0, TimeZone.getTimeZone("Europe/Zurich"));
+		//
+		doIsSessionTimeTest(schedule, false, 2012, Calendar.OCTOBER, 28, 01, 29, 0, TimeZone.getTimeZone("Europe/Zurich"));
+		doIsSessionTimeTest(schedule, true, 2012, Calendar.OCTOBER, 28, 01, 31, 0, TimeZone.getTimeZone("Europe/Zurich"));
+		doIsSessionTimeTest(schedule, true, 2012, Calendar.OCTOBER, 28, 02, 16, 0, TimeZone.getTimeZone("Europe/Zurich"));
+		doIsSessionTimeTest(schedule, true, 2012, Calendar.OCTOBER, 28, 03, 14, 0, TimeZone.getTimeZone("Europe/Zurich"));
+		doIsSessionTimeTest(schedule, false, 2012, Calendar.OCTOBER, 28, 03, 16, 0, TimeZone.getTimeZone("Europe/Zurich"));
+		//
+		doIsSessionTimeTest(schedule, false, 2012, Calendar.OCTOBER, 29, 01, 29, 0, TimeZone.getTimeZone("Europe/Zurich"));
+		doIsSessionTimeTest(schedule, true, 2012, Calendar.OCTOBER, 29, 01, 31, 0, TimeZone.getTimeZone("Europe/Zurich"));
+		doIsSessionTimeTest(schedule, true, 2012, Calendar.OCTOBER, 29, 02, 16, 0, TimeZone.getTimeZone("Europe/Zurich"));
+		doIsSessionTimeTest(schedule, true, 2012, Calendar.OCTOBER, 29, 03, 14, 0, TimeZone.getTimeZone("Europe/Zurich"));
+		doIsSessionTimeTest(schedule, false, 2012, Calendar.OCTOBER, 29, 03, 16, 0, TimeZone.getTimeZone("Europe/Zurich"));
+		//
+        schedule = new SessionSchedule(settings, sessionID);
+		doIsSessionTimeTest(schedule, false, 2013, Calendar.MARCH, 30, 01, 29, 0, TimeZone.getTimeZone("Europe/Zurich"));
+		doIsSessionTimeTest(schedule, true, 2013, Calendar.MARCH, 30, 01, 31, 0, TimeZone.getTimeZone("Europe/Zurich"));
+		doIsSessionTimeTest(schedule, true, 2013, Calendar.MARCH, 30, 02, 16, 0, TimeZone.getTimeZone("Europe/Zurich"));
+		doIsSessionTimeTest(schedule, true, 2013, Calendar.MARCH, 30, 03, 14, 0, TimeZone.getTimeZone("Europe/Zurich"));
+		doIsSessionTimeTest(schedule, false, 2013, Calendar.MARCH, 30, 03, 16, 0, TimeZone.getTimeZone("Europe/Zurich"));
+		//
+		doIsSessionTimeTest(schedule, false, 2013, Calendar.MARCH, 31, 01, 29, 0, TimeZone.getTimeZone("Europe/Zurich"));
+		doIsSessionTimeTest(schedule, true, 2013, Calendar.MARCH, 31, 01, 31, 0, TimeZone.getTimeZone("Europe/Zurich"));
+		doIsSessionTimeTest(schedule, false, 2013, Calendar.MARCH, 31, 02, 16, 0, TimeZone.getTimeZone("Europe/Zurich")); // -> this is 03:16 !
+		doIsSessionTimeTest(schedule, true, 2013, Calendar.MARCH, 31, 03, 14, 0, TimeZone.getTimeZone("Europe/Zurich"));
+		doIsSessionTimeTest(schedule, false, 2013, Calendar.MARCH, 31, 03, 16, 0, TimeZone.getTimeZone("Europe/Zurich"));
+		//
+		doIsSessionTimeTest(schedule, false, 2013, Calendar.APRIL, 1, 01, 29, 0, TimeZone.getTimeZone("Europe/Zurich"));
+		doIsSessionTimeTest(schedule, true, 2013, Calendar.APRIL, 1, 01, 31, 0, TimeZone.getTimeZone("Europe/Zurich"));
+		doIsSessionTimeTest(schedule, true, 2013, Calendar.APRIL, 1, 02, 16, 0, TimeZone.getTimeZone("Europe/Zurich"));
+		doIsSessionTimeTest(schedule, true, 2013, Calendar.APRIL, 1, 03, 14, 0, TimeZone.getTimeZone("Europe/Zurich"));
+		doIsSessionTimeTest(schedule, false, 2013, Calendar.APRIL, 1, 03, 16, 0, TimeZone.getTimeZone("Europe/Zurich"));
+    }
+    
+	public void testSettingsWithStartEndDayWithDST() throws Exception {
+        SessionSettings settings = new SessionSettings();
+        settings.setString(Session.SETTING_TIMEZONE, "America/New_York");
+        settings.setString(Session.SETTING_START_DAY, DayConverter.toString(Calendar.SUNDAY));
+        settings.setString(Session.SETTING_START_TIME, "20:00:00");
+        settings.setString(Session.SETTING_END_DAY, DayConverter.toString(Calendar.FRIDAY));
+        settings.setString(Session.SETTING_END_TIME, "17:00:00");
+        
+        SessionID sessionID = new SessionID("FIX.4.2", "SENDER", "TARGET");
+        SessionSchedule schedule = new SessionSchedule(settings, sessionID);
+        
+        //System.out.println(schedule);
+        
+        //November,2 -> Sunday
+        doIsSessionTimeTest(schedule, true, 2008, Calendar.NOVEMBER, 2, 20, 0, 0,
+                TimeZone.getTimeZone("America/New_York"));
+        //November,7 -> Friday
+        doIsSessionTimeTest(schedule, true, 2008, Calendar.NOVEMBER, 7, 17, 0, 0,
+                TimeZone.getTimeZone("America/New_York"));
+    }
+	
+	public void testSettingsWithStartEndDayWithDSTMocked() throws Exception {
+        SessionSettings settings = new SessionSettings();
+        settings.setString(Session.SETTING_TIMEZONE, "America/New_York");
+        settings.setString(Session.SETTING_START_DAY, DayConverter.toString(Calendar.SUNDAY));
+        settings.setString(Session.SETTING_START_TIME, "20:00:00");
+        settings.setString(Session.SETTING_END_DAY, DayConverter.toString(Calendar.FRIDAY));
+        settings.setString(Session.SETTING_END_TIME, "17:00:00");
+        
+        mockSystemTimeSource.setTime(getTimeStamp(2008, Calendar.NOVEMBER, 2, 18, 0, 0, TimeZone.getTimeZone("America/New_York")));
+        
+        SessionID sessionID = new SessionID("FIX.4.2", "SENDER", "TARGET");
+        SessionSchedule schedule = new SessionSchedule(settings, sessionID);
+        
+        //System.out.println(schedule);
+        
+        //November,2 -> Sunday
+        doIsSessionTimeTest(schedule, true, 2008, Calendar.NOVEMBER, 2, 20, 0, 0,
+                TimeZone.getTimeZone("America/New_York"));
+        //November,7 -> Friday
+        doIsSessionTimeTest(schedule, true, 2008, Calendar.NOVEMBER, 7, 17, 0, 0,
+                TimeZone.getTimeZone("America/New_York"));
+    }
 
     private void doWeeklyIsSameSessionTest(String startDay, String startTimeString, String endDay,
             String endTimeString) throws ConfigError, FieldConvertError, ParseException {
Index: main/java/quickfix/SessionSchedule.java
===================================================================
--- main/java/quickfix/SessionSchedule.java	(Revision 1110)
+++ main/java/quickfix/SessionSchedule.java	(Arbeitskopie)
@@ -31,7 +31,7 @@
 /**
  * Corresponds to SessionTime in C++ code
  */
-class SessionSchedule {
+public class SessionSchedule {
     private static final int NOT_SET = -1;
     private static final Pattern TIME_PATTERN = Pattern.compile("(\\d{2}):(\\d{2}):(\\d{2})(.*)");
     private final TimeEndPoint startTime;
@@ -39,7 +39,7 @@
     private final boolean nonStopSession;
     protected final static Logger log = LoggerFactory.getLogger(SessionSchedule.class);
 
-    SessionSchedule(SessionSettings settings, SessionID sessionID) throws ConfigError,
+    public SessionSchedule(SessionSettings settings, SessionID sessionID) throws ConfigError,
             FieldConvertError {
             
         if (settings.isSetting(sessionID, Session.SETTING_NON_STOP_SESSION)) {
@@ -76,25 +76,10 @@
             throw new ConfigError("Session " + sessionID + ": could not parse time '"
                     + settings.getString(sessionID, timeSetting) + "'.");
         }
-
-        TimeZone timeZone = getTimeZone(matcher.group(4), defaultTimeZone);
-
-        Calendar localTime = SystemTime.getUtcCalendar();
-        localTime.setTimeZone(timeZone);
-
-        localTime.set(Calendar.HOUR_OF_DAY, Integer.parseInt(matcher.group(1)));
-        localTime.set(Calendar.MINUTE, Integer.parseInt(matcher.group(2)));
-        localTime.set(Calendar.SECOND, Integer.parseInt(matcher.group(3)));
-
-        int scheduleDay = getDay(settings, sessionID, daySetting, NOT_SET);
-        if (scheduleDay != NOT_SET) {
-            localTime.set(Calendar.DAY_OF_WEEK, scheduleDay);
-        }
-
-        Calendar utcTime = SystemTime.getUtcCalendar();
-        utcTime.setTime(localTime.getTime());
-
-        return new TimeEndPoint(scheduleDay == NOT_SET ? NOT_SET : utcTime.get(Calendar.DAY_OF_WEEK), utcTime, utcTime.getTimeZone());
+        
+        return new TimeEndPoint(getDay(settings, sessionID, daySetting, NOT_SET), 
+        		Integer.parseInt(matcher.group(1)), Integer.parseInt(matcher.group(2)), 
+        		Integer.parseInt(matcher.group(3)), getTimeZone(matcher.group(4), defaultTimeZone));
     }
 
     private TimeZone getDefaultTimeZone(SessionSettings settings, SessionID sessionID)
@@ -194,27 +179,32 @@
     private TimeInterval theMostRecentIntervalBefore(Calendar t) {
         TimeInterval timeInterval = new TimeInterval();
         Calendar intervalStart = timeInterval.getStart();
-
+        intervalStart.setTimeZone(startTime.getTimeZone());
         intervalStart.setTimeInMillis(t.getTimeInMillis());
         intervalStart.set(Calendar.HOUR_OF_DAY, startTime.getHour());
         intervalStart.set(Calendar.MINUTE, startTime.getMinute());
         intervalStart.set(Calendar.SECOND, startTime.getSecond());
         intervalStart.set(Calendar.MILLISECOND, 0);
+        
+        Calendar intervalEnd = timeInterval.getEnd();
+        intervalEnd.setTimeZone(endTime.getTimeZone());
+        intervalEnd.setTimeInMillis(t.getTimeInMillis());
+        intervalEnd.set(Calendar.HOUR_OF_DAY, endTime.getHour());
+        intervalEnd.set(Calendar.MINUTE, endTime.getMinute());
+        intervalEnd.set(Calendar.SECOND, endTime.getSecond());
+        intervalEnd.set(Calendar.MILLISECOND, 0);
+        
         if (isSet(startTime.getDay())) {
             intervalStart.set(Calendar.DAY_OF_WEEK, startTime.getDay());
             if (intervalStart.getTimeInMillis() > t.getTimeInMillis()) {
                 intervalStart.add(Calendar.WEEK_OF_YEAR, -1);
+                intervalEnd.add(Calendar.WEEK_OF_YEAR, -1);
             }
         } else if (intervalStart.getTimeInMillis() > t.getTimeInMillis()) {
             intervalStart.add(Calendar.DAY_OF_YEAR, -1);
-        }
-
-        Calendar intervalEnd = timeInterval.getEnd();
-        intervalEnd.setTimeInMillis(intervalStart.getTimeInMillis());
-        intervalEnd.set(Calendar.HOUR_OF_DAY, endTime.getHour());
-        intervalEnd.set(Calendar.MINUTE, endTime.getMinute());
-        intervalEnd.set(Calendar.SECOND, endTime.getSecond());
-        intervalEnd.set(Calendar.MILLISECOND, 0);
+            intervalEnd.add(Calendar.DAY_OF_YEAR, -1);
+        }        
+        
         if (isSet(endTime.getDay())) {
             intervalEnd.set(Calendar.DAY_OF_WEEK, endTime.getDay());
             if (intervalEnd.getTimeInMillis() <= intervalStart.getTimeInMillis()) {
@@ -233,7 +223,7 @@
         private Calendar end = SystemTime.getUtcCalendar();
 
         public boolean isContainingTime(Calendar t) {
-            return t.equals(start) || t.equals(end) || (t.after(start) && t.before(end));
+        	return t.compareTo(start) >= 0 && t.compareTo(end) <= 0;
         }
 
         public String toString() {
@@ -303,8 +293,8 @@
         formatTimeInterval(buf, ti, timeFormat, false);
 
         // Now the localized equivalents, if necessary
-        if (startTime.getTimeZone() != SystemTime.UTC_TIMEZONE
-                || endTime.getTimeZone() != SystemTime.UTC_TIMEZONE) {
+        if (!startTime.getTimeZone().equals(SystemTime.UTC_TIMEZONE)
+                || !endTime.getTimeZone().equals(SystemTime.UTC_TIMEZONE)) {
             buf.append(" (");
             formatTimeInterval(buf, ti, timeFormat, true);
             buf.append(")");
