我需要多久更新一次野田时间时区数据库,自动更新的步骤是什么?
最佳答案
How frequently I need to update timezone database.
当它改变时:)
您可以通过获取 http://nodatime.org/tzdb/latest.txt 来找到这一点其中始终包含最新 .nzd 文件的 URL。
或者,如果您不需要自动化,请订阅 <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="e6929ccb8788888993888583a68f878887c8899481" rel="noreferrer noopener nofollow">[email protected]</a>
邮件列表(通过 IANA time zone home page )- 包含每个版本的公告。
What are the steps to automatically update the timezone database.
下载最新的.nzd 文件,然后创建 TzdbDataSource
从中,as documented in the user guide :
IDateTimeZoneProvider provider;
using (var stream = File.OpenRead(...))
{
var source = TzdbDateTimeZoneSource.FromStream(stream);
provider = new DateTimeZoneCache(source);
}
当然,这是假设您乐意等待我构建 nzd 文件并上传它。或者,您可以获取 latest source code ,构建NodaTime-All
解决方案,然后运行 NodaTime.TzdbCompiler
自己实用。现在这比以前更容易,因为您只需指定最新 .tar.gz 文件的 URL 和包含 CLDR 文件的目录即可。
没有简单的更新方法 NodaTime.dll
本身嵌入了 tz 数据库的新版本 - 基本上它附带了构建时当前的任何内容,如果您想要更新的内容,您需要使用上面的代码。
关于.net - 如何自动更新野田时间数据库,多久更新一次?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31645808/