dousong5492 2017-11-17 21:09 采纳率: 100%
浏览 92

在进行中有没有一种方法可以公开用于位置zone和zoneTrans的数据?

I would like to know when a Location's offset from UTC is going to change. I see that this information is known by the time package, obviously or it wouldn't be able to account for daylight savings. That way I could find out that for the location "America/New_York" daylight savings begins on Sunday, March 11 2018 at 07:00 UTC.

Is there a way to do this short of making my own copy of the time package that exports the Location properties or writing my own parser for the time zone files?

  • 写回答

1条回答 默认 最新

  • duande1146 2017-11-17 21:15
    关注

    As you've seen in the source, no, that information is not exposed. But, as you can also see from the source, the raw TZDB used to generate the timezones is included in the Go distribution:

    //go:generate env ZONEINFO=$GOROOT/lib/time/zoneinfo.zip go run genzabbrs.go -output zoneinfo_abbrs_windows.go
    

    If you take a look at your $GOROOT/lib/time you'll find that file, which contains all the data used to generate the time zone list, and you can look at $GOROOT/src/time/genzabbrs.go to see how it's used.

    评论

报告相同问题?

悬赏问题

  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
  • ¥15 关于smbclient 库的使用