首页 > 解决方案 > DateTime 是否包含第二次闰功能?

问题描述

在本文中:.Net 的 DateTime 方法是否能够识别闰秒?,作者得到答案“它(日期时间)不包括可归因于闰秒的滴答数。”

但是,以下代码显示 .Net DateTime 支持闰秒。哪位专家能解释一下为什么?

Dim GPS_Time_Base_Point As DateTime = New DateTime(1980, 1, 6, 0, 0, 0, DateTimeKind.Unspecified)
Dim A_test_time As DateTime = New DateTime(2019, 4, 16, 18, 29, 0, DateTimeKind.Unspecified)

Dim TimeSpan As TimeSpan = A_test_time - GPS_Time_Base_Point
Dim GPS_Time_At_LIGO_for_2019_4_16_18_29_0 As UInt64 = 1239474558 'https://www.andrews.edu/~tzs/timeconv/timeconvert.php
Dim DifSeconds As Integer = TimeSpan.TotalSeconds - 1239474558
Debug.Print(" Second dif:" + CDbl(DifSeconds).ToString)

输出为“Second dif:-18”,它等于 gpstime - UTC 时间的闰秒差异。

标签: vb.netdatetime

解决方案


推荐阅读