Re: golang zoneinfo need to be updated

238 views
Skip to first unread message

Ian Lance Taylor

unread,
Nov 23, 2022, 1:03:32 AM11/23/22
to Jianyong Guo, Heschi Kreinick, golan...@googlegroups.com, mdem...@google.com
Answered on the issue.  I'm unable to recreate the problem.  And I don't see why there would be a problem, as the time package uses the same data source (the extend string) as the zic program does.  Thanks.

Ian

On Tue, Nov 22, 2022 at 7:00 PM Jianyong Guo <coolki...@gmail.com> wrote:


Title is  "tzdata error/go 1.19: zoneinfo error for America/Tijuana #56913"

### How to reproduce the problem
```
step 1. run update.bash update zoneinfo.zip to 2022f

step 2.  run test code
loc, _ = time.LoadLocation("America/Tijuana")
time_str := time.Now().In(loc).Format("2006-01-02 15:04:05")

step 3. check result
The result should be "2022-11-22 18:49:05"
But got "2022-11-22 19:49:05"
```

Jianyong Guo <coolki...@gmail.com> 于2022年11月23日周三 10:32写道:
Hi, Iant
 I am doing some test for timezone, I found that, if no using -R option,  the zoneinfo.zip data will be wrong for America/Tijuana (a timezone for Mexcio)
The last item in transform vector is 1268560800 which is 2010-03-14 18:00:00,  The result will be wrong for code like this:
loc, _ = time.LoadLocation("America/Tijuana")
time_str := time.Now().In(loc).Format("2006-01-02 15:04:05")


image.png




Freeman Guo 

Heschi Kreinick <hes...@google.com> 于2022年11月23日周三 01:12写道:
I don't know very much about tzdata. Would you like to send a mail to golan...@googlegroups.com or file an issue at go.dev/issue/new?

On Tue, Nov 22, 2022 at 7:32 AM Jianyong Guo <coolki...@gmail.com> wrote:

Hi,

I found that the zoneinfo.zip data in latest golang versions is error (such go 1.18, go 1.19)

Because from tzdata 2022b, the zoneinfo generator zic has changed, and -R  parameter  is  add. 

-R parameter is using to generate redundant data until to 2038


How to fix:

  1. tzdata 2022f is released and the golang /lib/time/zoneinfo.zip need to be updated.
  2. the update.bash script has some error, -R args is need for building zoneinfo data.

            make CFLAGS=-DSTD_INSPIRED AWK=awk TOPDIR=output install

            shoule be:
            make CFLAGS=-DSTD_INSPIRED AWK=awk TOPDIR=output   ZFLAGS='-R "@2137586400"'   install

  1. -R paramter is using to generate future DST rules.  
           Without -R parameter:  the zoneinfo data can only cover just NEXT year, e.g [1970, .... 2023]
           With -R:  Can generate all futher DST time, e.g  [1970, .... 2023,  2024,  2025, ... 2038]




Freeman Guo 


--
╔═══ ══ ══ ═══ ═══ ══ ══   ═══╗
郭建勇
╚═══ ══ ══ ═══ ═══ ══ ══ ═══ ═══ ══ ══ ═══╝  


--
╔═══ ══ ══ ═══ ═══ ══ ══   ═══╗
郭建勇
╚═══ ══ ══ ═══ ═══ ══ ══ ═══ ═══ ══ ══ ═══╝  

Jianyong Guo

unread,
Nov 23, 2022, 3:06:48 PM11/23/22
to Heschi Kreinick, golan...@googlegroups.com, mdem...@google.com, ia...@golang.org
Reply all
Reply to author
Forward
0 new messages