Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 85c128f1f7cc5757f04add156207b1658f452cd22ba67ec2847b6bc682ee8fca
Ticket: dc69e5ecf04313429fd202b1906cd85bb7888f95
[clock scan] does not recognize AKST or AKDT
User & Date: sebres on 2018-05-25 19:43:26
Changes

  1. icomment:
    When tinkering round about time-zones abbreviations (which conflict more and more), I've even more questions...
    
    @Peter da Silva, @Karl Lehenbauer, @flightaware: <ul>
    <li>  How do you handle such confusions by the different time-zones with the same abbreviation by the flight tracking or similar services?</li></ul>
    
    @Chinese Tclers: <ul>
    <li>  How you resolve such conflicts, e. g. with CST-abbreviation by string as date interpolation? 
    <li>  Using custom time-zones files?</li>
    <li>  Somehow else?</li></ul>
    
    For example, I mean the "CST" abbreviation (as provided from iana-tzdb, therefore in TCL also):<ul>
    <li>"CST" - "Central Standard Time" ("America/Chicago", etc.)</li>
    <li>"CST" - "Central Standard Time (with 1 hour offset)" ("America/Havana")</li>
    <li>"CST" - "China Standard Time" ("Asia/Shanghai", "Asia/Taipei", etc.) </li>
    </ul>
    
    So forwards-backwards conversion test like this:
    <code><pre style="padding-left:15pt">
    set tm [clock scan "01/01/2018" -gmt 1]
    puts "utc: $tm, [clock format $tm -g 1 -l en]"
    set testtz {
      :America/Chicago   {CST}
      CST6               {CST}
      :America/Havana  {CST+1}
      CST5             {CST+1}
      :Asia/Shanghai  {CST+14}
      :Asia/Taipei    {CST+14}
      CST-8           {CST+14}
    }
    # direct forward - backwards:
    foreach {tz alt_tz} $testtz {
      puts "[format %20s $tz]: [set str [clock format $tm -timezone $tz -l en]] \
      \t--> [set tm2 [clock scan $str]] = [clock format $tm2 -g 1 -l en]"
    }
    # show alternative (does not work in tcl.core, currently tclclockmod only):
    puts "# alternatives:"
    foreach {tz alt_tz} $testtz {
      set str [clock format $tm -timezone $tz -l en]
      set str [string map [list CST $alt_tz] $str]
      puts "[format %20s $tz]: $str \
      \t--> [set tm2 [clock scan $str]] = [clock format $tm2 -g 1 -l en]"
    }
    </pre></code>
    results to:
    <code><pre style="padding-left:15pt">
    utc: 1514764800, Mon Jan 01 00:00:00 GMT 2018<small style="color:green">
        :America/Chicago: Sun Dec 31 18:00:00 CST 2017      --> 1514764800 = Mon Jan 01 00:00:00 GMT 2018
                    CST6: Sun Dec 31 18:00:00 CST 2017      --> 1514764800 = Mon Jan 01 00:00:00 GMT 2018</small><small style="color:blue">
         :America/Havana: Sun Dec 31 19:00:00 CST 2017      --> <b>1514768400</b> = Mon Jan 01 <b>01:00:00</b> GMT 2018
                    CST5: Sun Dec 31 19:00:00 CST 2017      --> <b>1514768400</b> = Mon Jan 01 <b>01:00:00</b> GMT 2018</small><small style="color:red">
          :Asia/Shanghai: Mon Jan 01 08:00:00 CST 2018      --> <b>1514815200</b> = Mon Jan 01 <b>14:00:00</b> GMT 2018
            :Asia/Taipei: Mon Jan 01 08:00:00 CST 2018      --> <b>1514815200</b> = Mon Jan 01 <b>14:00:00</b> GMT 2018
                   CST-8: Mon Jan 01 08:00:00 CST 2018      --> <b>1514815200</b> = Mon Jan 01 <b>14:00:00</b> GMT 2018</small>
    # alternatives:<small style="color:green">
        :America/Chicago: Sun Dec 31 18:00:00 CST 2017      --> 1514764800 = Mon Jan 01 00:00:00 GMT 2018
                    CST6: Sun Dec 31 18:00:00 CST 2017      --> 1514764800 = Mon Jan 01 00:00:00 GMT 2018</small><small style="color:blue">
         :America/Havana: Sun Dec 31 19:00:00 CST+1 2017    --> 1514764800 = Mon Jan 01 00:00:00 GMT 2018
                    CST5: Sun Dec 31 19:00:00 CST+1 2017    --> 1514764800 = Mon Jan 01 00:00:00 GMT 2018</small><small style="color:red">
          :Asia/Shanghai: Mon Jan 01 08:00:00 CST+14 2018   --> 1514764800 = Mon Jan 01 00:00:00 GMT 2018
            :Asia/Taipei: Mon Jan 01 08:00:00 CST+14 2018   --> 1514764800 = Mon Jan 01 00:00:00 GMT 2018
                   CST-8: Mon Jan 01 08:00:00 CST+14 2018   --> 1514764800 = Mon Jan 01 00:00:00 GMT 2018</small>
    </pre></code>
    
    @Everyone: <ul>
    <li>  Had someone already such issues at all?</li>
    <li>  Do we have a "bug" in clock module (format resp. scan) for several zones?</li>
    <li>  Should we fix the abbreviations for several zones (leave most popular/usual unchanged, replace others with another abbreviations or/and offsets)?</li></ul>
    
  2. login: "sebres"
  3. mimetype: "text/x-fossil-wiki"