Skip to content

Conversation

@jackmath5261-bit
Copy link
Contributor

No description provided.

@jackmath5261-bit jackmath5261-bit merged commit 68023c2 into main Feb 12, 2026
4 checks passed
@jackmath5261-bit jackmath5261-bit deleted the jie/210_15/time_date_convert branch February 12, 2026 01:43
Copy link
Collaborator

@jetjinser jetjinser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

;; 2000-02-29 leap day
(let* ((d1 (make-date 0 0 0 0 29 2 2000 0))
       (t (date->time-utc d1))
       (d2 (time-utc->date t)))
  (check (date-year d2) => 2000)
  (check (date-month d2) => 2) ; got 3
  (check (date-day d2) => 29)) ; got 1

这个结果算错的。可以检查下 priv:days-before-year,再多加些类似的边界的测试

Comment on lines +419 to +423
(define (priv:days-before-year year)
(+ (* 365 year)
(floor-quotient year 4)
(- (floor-quotient year 100))
(floor-quotient year 400)))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可能是这个算错了

Comment on lines +814 to +820
#|
time-utc->date
将 TIME-UTC 时间对象转换为日期对象。

date->time-utc
将日期对象转换为 TIME-UTC 时间对象。
|#
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

写得太简略了。另外

time-utc->date time-utc [tz-offset] -> time-utc
    Convert UTC time to date, using time zone offset, which defaults to the local time zone. 

规范中要求使用本地时区,虽然现在没有做接口(得到当前时区),但是这一点要明确写出来。留个 TODO 之后需要实现

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants