如何自动更新野田时间数据库,多久更新一次?

How to automatically update the Noda Time database, and how often?

我需要多久更新一次 Noda Time 时区数据库,自动更新的步骤是什么?

How frequently I need to update timezone database.

当它改变时:)

你可以通过获取 http://nodatime.org/tzdb/latest.txt 找到它,它总是包含最新的 .nzd 文件的 URL。

或者,如果您不需要自动化,请订阅 tz-announce@iana.org 邮件列表(通过 IANA time zone home page)- 其中包含每个版本的公告。

What are the steps to automatically update the timezone database.

下载最新的 .nzd 文件,然后从中创建一个 TzdbDataSourceas 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 实用程序。现在这比以前更容易了,因为您只需指定一个 URL 到最新的 .tar.gz 文件和包含 CLDR 文件的目录。

没有一种简单的方法来更新 NodaTime.dll 本身以嵌入新版本的 tz 数据库 - 基本上它带有构建时的最新版本,如果你想要更新的东西,你需要用到上面的代码。