知识卡片
持续时间带着明确计量单位
time.Duration是以纳秒计数的有符号整数时长,乘time.Second或Minute表达可读单位。本例每轮间隔=(5+人数)分钟,5人对应10分钟,7人对应12分钟。应区分时长与具体时刻,换单位或接收人数时还要检查范围,避免负时长和溢出。
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
在整书笔记中的位置
- · Time
原书出处 · 1 处
- Time · 查看原书依据
uct { alerts []struct{ scheduledAt time.Duration amount int } } func (s *SpyBlindAlerter) ScheduleAlertAt(duration time.Duration, amount int) { s.aler
参考来源
- 位置:《通过测试学习 Go 编程》Time,spine027(book-sources;extracted/通过测试学习 Go 编程/_epub-src/OEBPS/Text/26.html)。
- 结论依据:原文定义Duration并用人数计算blindIncrement。
- 原始内容:uct { alerts []struct{ scheduledAt time.Duration amount int } } func (s *SpyBlindAlerter) ScheduleAlertAt(duration time.Duration, amount int) { s.aler