-
Notifications
You must be signed in to change notification settings - Fork 28
[210_13] srfi-19 time-difference实现 #400
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
jetjinser
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
要写一下 devel/210_13.md
goldfish/srfi/srfi-19.scm
Outdated
| (unless (eq? (time-type time1) (time-type time2)) | ||
| (error 'wrong-type-arg "time-difference: time types must match" | ||
| (list (time-type time1) (time-type time2)))) | ||
| (set-time-type! time3 TIME-DURATION) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里不需要再 set-time-type! 了,传进来的就是
goldfish/srfi/srfi-19.scm
Outdated
| (if (and (= (time-second time1) (time-second time2)) | ||
| (= (time-nanosecond time1) (time-nanosecond time2))) | ||
| (begin | ||
| (set-time-second! time3 0) | ||
| (set-time-nanosecond! time3 0)) | ||
| (receive (nanos secs) | ||
| (priv:nanoseconds->values (- (priv:time->nanoseconds time1) | ||
| (priv:time->nanoseconds time2))) | ||
| (set-time-second! time3 secs) | ||
| (set-time-nanosecond! time3 nanos))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 不需要判相等设置0,直接计算就行
- 不要写
priv:nanoseconds->values这个小函数,命名不清楚,而这里直接写 floor/ 内联进来就行。
jetjinser
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
No description provided.