Go-time-库

两个时间概念:

  • Wall clock, 指真实时间, 就像墙上的挂钟上看到的时间一样
  • Monotonic clock, 指一个递增的计时器, 可以用于测量时间

type Duration

1
type Duration int64

指两个 instants 之间的 elapsed time.

常见的有:

  • time.Microsecond
  • time.Millisecond
  • time.Second
  • time.Minute
  • time.Hour

type Time

用于标记类型的空结构体:

1
2
3
type Time struct {
// contains filtered or unexported fields
}

Go-time-库
http://example.com/2024/02/18/Go-time-库/
作者
Jie
发布于
2024年2月18日
许可协议