Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 85fc6b678445bb289427ec85f26bc3e1dcce8a12
Ticket: 217968ffffffffffffffffffffffffffffffffff
clock scan doesn't handle GMT+xxxx timezones
User & Date: nobody on 2000-10-26 00:46:55
Changes

  1. assignee changed to: "nobody"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    OriginalBugID: 4862 RFE
    Version: 8.3
    SubmitDate: '2000-04-05'
    LastModified: '2000-06-26'
    Severity: MED
    Status: Closed
    Submitter: techsupp
    ChangedBy: ericm
    RelatedBugIDs: 5297
    OS: Windows NT
    OSVersion: 4.0 sp5
    Machine: AMD K6-2/333 128MB RAM
    FixedDate: '2000-06-26'
    ClosedDate: '2000-10-25'
    
    
    Name:
    David Cuthbert
    
    CVS:
    05 April 2000 00:30 EDT
    
    Extensions:
    [incr Tcl] 3.1.0
    
    CustomShell:
    None
    
    Comments:
    The following Tcl script is being used as a workaround:
    
      proc ::Kanga::Article::ScanDate {date} {
         # Try to handle this in Tcl, if possible
          set cr [catch { set scan [clock scan $date] }]
    
          if {!$cr} { return $scan }
    
          # Hmm... ok, try to pick out any strings like "GMT+0100" or "+0100"
          set pluspos  [string last "+" $date]
          set minuspos [string last "-" $date]
    
          if {$pluspos > $minuspos} { 
      set pos $pluspos
          } else {
      set pos $minuspos 
          }
    
          if {$pos != -1} {
      # Ok, see if there are four digits following this
      set offset [string range $date [expr {$pos+1}] [expr {$pos+4}]]
      if {[string length $offset] == 4 &&
          [string is digit $offset] &&
          [string index $offset end] == "0"} {
          # Finally, see if there is "GMT" or "GMT " preceding this
          if {[string range $date [expr {$pos-3}]  [expr {$pos-1}]] == "GMT"} {
      set basedate [string range $date 0 [expr {$pos-4}]]
          } elseif {[string range $date [expr {$pos-4}]  [expr {$pos-1}]] == "GMT "} {
      set basedate [string range $date 0 [expr {$pos-5}]]
          } else {
      set basedate [string range $date 0 [expr {$pos-1}]]
          }
    
          set cr [catch {
      if {[string index $date $pos] == "-"} {
          set mult -1
      } else {
          set mult 1
       }
    
      set hr [string range $offset 0 1]
      set mn [string range $offset 2 3]
    
       # Avoid accidental octal conversion
        if {[string index $hr 0] == "0"} { 
            set hr [string index $hr end]
        }
    
        if {[string index $mn 0] == "0"} {
            set mn [string index $mn end]
        }
    
        set scan [expr {[clock scan $basedate -gmt 1] +
        $mult * $hr * 3600 +
        $mult * $mn * 60}]
            }]
    
          if {!$cr} {
      return $scan
          }
      }
          }
    
          # Nothing has worked.  Return an error
          error "cannot convert $date to a date/time."
      }
    
    DesiredBehavior:
    I would like [clock scan] to be able to handle: "Wed, 15 Mar 2000 16:50:23 +0100" (produced by some newsreaders)
    
    Workaround:
    
    
    
    
    
  4. foundin changed to: "obsolete: 8.3"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "nobody"
  9. subsystem changed to: "48. Number Handling"
  10. title changed to: "clock scan doesn't handle GMT+xxxx timezones"
  11. type changed to: "Bug"