Tk Library Source Code

Artifact [df6c2957b3]
Login

Artifact df6c2957b3a10de82a30234e04ff56873b97deb0:

Attachment "1312869_mime.patch" to ticket [1276561fff] added by andreas_kupries 2005-10-05 01:15:04. Also attachment "mime.patch" to ticket [1312869fff] added by cc_benny 2005-10-04 20:20:57.
--- mime.tcl.original	2005-10-04 14:43:15.696244660 +0200
+++ mime.tcl	2005-10-04 15:05:22.316195333 +0200
@@ -3235,6 +3235,16 @@ proc ::mime::addr_x400 {mbox key} {
 #	Returns the string value of the 'property' for the date/time that was
 #       specified in 'value'.
 
+namespace eval ::mime {
+        variable WDAYS_SHORT  [list Sun Mon Tue Wed Thu Fri Sat]
+        variable WDAYS_LONG   [list Sunday Monday Tuesday Wednesday Thursday \
+                                    Friday Saturday]
+
+        variable MONTHS_SHORT [list Jan Feb Mar Apr May Jun \
+                                    Jul Aug Sep Oct Nov Dec]
+        variable MONTHS_LONG  [list January February March April May June July \
+                                    August Sepember October November December]
+}
 proc ::mime::parsedatetime {value property} {
     if {![string compare $value -now]} {
         set clock [clock seconds]
@@ -3248,11 +3258,13 @@ proc ::mime::parsedatetime {value proper
         }
 
         lmonth {
-            return [clock format $clock -format %B]
+            variable MONTHS_LONG
+            return [lindex $MONTHS_LONG [clock format $clock -format %e]]
         }
 
         lweekday {
-            return [clock format $clock -format %A]
+            variable WDAYS_LONG
+            return [lindex $WDAYS_LONG [clock format $clock -format %w]]
         }
 
         mday {
@@ -3268,11 +3280,12 @@ proc ::mime::parsedatetime {value proper
         }
 
         month {
-            return [clock format $clock -format %b]
+            variable MONTHS_SHORT
+            return [lindex $MONTHS_SHORT [clock format $clock -format %e]]
         }
 
         proper {
-            set gmt [clock format $clock -format "%d %b %Y %H:%M:%S" \
+            set gmt [clock format $clock -format "%Y-%m-%d %H:%M:%S" \
                            -gmt true]
             if {[set diff [expr {($clock-[clock scan $gmt])/60}]] < 0} {
                 set s -
@@ -3282,8 +3295,13 @@ proc ::mime::parsedatetime {value proper
             }
             set zone [format %s%02d%02d $s [expr {$diff/60}] [expr {$diff%60}]]
 
+            variable WDAYS_SHORT
+            set wday [lindex $WDAYS_SHORT [clock format $clock -format %w]]
+            variable MONTHS_SHORT
+            set mon [lindex $MONTHS_SHORT [clock format $clock -format %e]]
+
             return [clock format $clock \
-                          -format "%a, %d %b %Y %H:%M:%S $zone"]
+                          -format "$wday, %d $mon %Y %H:%M:%S $zone"]
         }
 
         rclock {
@@ -3303,7 +3321,8 @@ proc ::mime::parsedatetime {value proper
         }
 
         weekday {
-            return [clock format $clock -format %a]
+            variable WDAYS_SHORT
+            return [lindex $WDAYS_SHORT [clock format $clock -format %w]]
         }
 
         yday {