Tcl Source Code

Artifact [ce19527106]
Login

Artifact ce195271064297e190a12fcafb7221d304930195:

Attachment "clock.patch" to ticket [2207436fff] added by nijtmans 2008-12-01 18:14:30.
*** library/clock.tcl.orig	Sun Nov 30 20:31:08 2008
--- library/clock.tcl	Sun Nov 30 20:30:39 2008
***************
*** 3883,3905 ****
  			      * $dstSignum }]
      }
  
!     # Fill in defaults for US DST rules
  
      if { [dict get $z startDayOfYear] eq {} 
  	 && [dict get $z startMonth] eq {} } {
  	dict set z startMonth 3
- 	dict set z startWeekOfMonth 2
  	dict set z startDayOfWeek 0
- 	dict set z startHours 2
  	dict set z startMinutes 0
  	dict set z startSeconds 0
      }
      if { [dict get $z endDayOfYear] eq {} 
  	 && [dict get $z endMonth] eq {} } {
! 	dict set z endMonth 11
! 	dict set z endWeekOfMonth 1
  	dict set z endDayOfWeek 0
- 	dict set z endHours 2
  	dict set z endMinutes 0
  	dict set z endSeconds 0
      }
--- 3883,3924 ----
  			      * $dstSignum }]
      }
  
!     # Fill in defaults for European or US DST rules
  
      if { [dict get $z startDayOfYear] eq {} 
  	 && [dict get $z startMonth] eq {} } {
+ 	if {($stdHours>=0) && ($stdHours<=12)} {
+ 	    dict set z startWeekOfMonth 5
+ 	    if {$stdHours>1} {
+ 		dict set z startHours 2
+ 	    } else {
+ 		dict set z startHours [expr {$stdHours+1}]
+ 	    }
+ 	} else {
+ 	    dict set z startWeekOfMonth 2
+ 	    dict set z startHours 2
+ 	}
  	dict set z startMonth 3
  	dict set z startDayOfWeek 0
  	dict set z startMinutes 0
  	dict set z startSeconds 0
      }
      if { [dict get $z endDayOfYear] eq {} 
  	 && [dict get $z endMonth] eq {} } {
! 	if {($stdHours>=0) && ($stdHours<=12)} {
! 	    dict set z endMonth 10
! 	    dict set z endWeekOfMonth 5
! 	    if {$stdHours>1} {
! 		dict set z endHours 3
! 	    } else {
! 		dict set z endHours [expr {$stdHours+2}]
! 	    }
! 	} else {
! 	    dict set z endMonth 11
! 	    dict set z endWeekOfMonth 1
! 	    dict set z endHours 2
! 	}
  	dict set z endDayOfWeek 0
  	dict set z endMinutes 0
  	dict set z endSeconds 0
      }
*** tests/clock.test.orig	Sun Nov 30 20:33:43 2008
--- tests/clock.test	Sun Nov 30 20:31:31 2008
***************
*** 36083,36088 ****
--- 36083,36110 ----
      set result
  } {01:59:59 01:59:59 03:00:00 03:00:00}
  
+ test clock-52.2 {correct conversion of times in Europe} {
+    # [Bug 2207436]
+    set result {}
+    foreach t [list 1206838799 1206838800 1224982799 1224982800] {
+        lappend result [clock format $t -format %H:%M:%S \
+                            -timezone MET-1METDST]
+        lappend result [clock format $t -format %H:%M:%S \
+                            -timezone MET0METDST]
+    }
+    set result
+ } {01:59:59 00:59:59 03:00:00 02:00:00 02:59:59 01:59:59 02:00:00 01:00:00}
+ 
+ test clock-52.3 {correct conversion of times in Russia} {
+    # [Bug 2207436]
+    set result {}
+    foreach t [list 1206799199 1206799200 1224943199 1224943200] {
+        lappend result [clock format $t -format %H:%M:%S \
+                            -timezone WST-12WSTDST]
+    }
+    set result
+ } {01:59:59 03:00:00 02:59:59 02:00:00}
+ 
  # Regression test for Bug # 1505383
  
  test clock-53.1 {%EC %Ey} {