Skip to content

Commit

Permalink
enable leap second
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaaagaa committed Apr 23, 2023
1 parent ead3b46 commit 332cf26
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/xtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ xtime_vnsec_t time_dtov(xtime_descr_t xtm_descr)
(xtm_descr.ctx_day < 1) || (xtm_descr.ctx_day > 31) ||
(xtm_descr.ctx_hour > 23) ||
(xtm_descr.ctx_minute > 59) ||
(xtm_descr.ctx_second > 59) ||
(xtm_descr.ctx_second > 60) ||
(xtm_descr.ctx_msec > 999))
{
return XTIME_INVALID_VNSEC;
Expand Down Expand Up @@ -313,7 +313,7 @@ x_bool_t time_descr_valid(xtime_descr_t xtm_descr)
(xtm_descr.ctx_week > 6) ||
(xtm_descr.ctx_hour > 23) ||
(xtm_descr.ctx_minute > 59) ||
(xtm_descr.ctx_second > 59) ||
(xtm_descr.ctx_second > 60) ||
(xtm_descr.ctx_msec > 999))
{
xbt_valid = X_FALSE;
Expand Down
2 changes: 1 addition & 1 deletion src/xtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ typedef union xtime_descr_t
x_uint32_t ctx_week : 4; ///< 周几(0 ~ 6)
x_uint32_t ctx_hour : 6; ///< 时(0 ~ 23)
x_uint32_t ctx_minute : 6; ///< 分(0 ~ 59)
x_uint32_t ctx_second : 6; ///< 秒(0 ~ 59)
x_uint32_t ctx_second : 6; ///< 秒(0 ~ 60),上限定为 60 而不是 59,主要考虑 闰秒 的存在
x_uint32_t ctx_msec : 14; ///< 毫秒(0 ~ 999)
};
} xtime_descr_t;
Expand Down

0 comments on commit 332cf26

Please sign in to comment.