+
Skip to content

Tags: golang/time

Tags

v0.14.0

Toggle v0.14.0's commit message
rate: use time.Time.Equal instead of ==

According to the Time Type documentation, in most cases, it is better
to use Equal instead of ==


Change-Id: I201de68ee163a06cf9ed49f7b77a2de031dbdd95
Reviewed-on: https://go-review.googlesource.com/c/time/+/703175
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Florian Lehner <lehner.florian86@gmail.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Mark Freeman <markfreeman@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

v0.13.0

Toggle v0.13.0's commit message
all: upgrade go directive to at least 1.24.0 [generated]

By now Go 1.25.0 has been released, and Go 1.23 is no longer supported
per the Go Release Policy (see https://go.dev/doc/devel/release#policy).

For golang/go#69095.

[git-generate]
(cd . && go get go@1.24.0 && go mod tidy && go fix ./... && go mod edit -toolchain=none)

Change-Id: Ia825a8b8f8877f184dd89af70b85a9d3facbbf19
Reviewed-on: https://go-review.googlesource.com/c/time/+/695675
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>

v0.12.0

Toggle v0.12.0's commit message
rate: skip time.Now call in Sometimes.Do unless necessary

Don't update Sometimes.last if Interval is not configured.

goos: darwin
goarch: arm64
pkg: golang.org/x/time/rate
                          │ /tmp/before.txt │           /tmp/after.txt            │
                          │     sec/op      │   sec/op     vs base                │
Sometimes/no-interval-8         14.81n ± 0%   11.96n ± 0%  -19.25% (p=0.000 n=10)
Sometimes/with-interval-8       27.30n ± 2%   27.57n ± 2%        ~ (p=0.780 n=10)
geomean                         20.10n        18.15n        -9.70%

goos: linux
goarch: arm64
pkg: golang.org/x/time/rate
                          │ /tmp/before-rpi.txt │         /tmp/after-rpi.txt          │
                          │       sec/op        │   sec/op     vs base                │
Sometimes/no-interval-4             89.72n ± 4%   77.03n ± 2%  -14.15% (p=0.000 n=10)
Sometimes/with-interval-4           147.1n ± 0%   147.8n ± 3%   +0.48% (p=0.005 n=10)
geomean                             114.9n        106.7n        -7.12%

Change-Id: Ie4a064625432b9628a1cc5686eca9f0b3b90fb7b
Reviewed-on: https://go-review.googlesource.com/c/time/+/561956
Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Sean Liao <sean@liao.dev>
Reviewed-by: Sean Liao <sean@liao.dev>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>

v0.11.0

Toggle v0.11.0's commit message
all: upgrade go directive to at least 1.23.0 [generated]

By now Go 1.24.0 has been released, and Go 1.22 is no longer supported
per the Go Release Policy (https://go.dev/doc/devel/release#policy).

For golang/go#69095.

[git-generate]
(cd . && go get go@1.23.0 && go mod tidy && go fix ./... && go mod edit -toolchain=none)

Change-Id: Iaeb32276091bcf93b9f9ccde96e2705fe6367860
Reviewed-on: https://go-review.googlesource.com/c/time/+/649718
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Gopher Robot <gobot@golang.org>

v0.10.0

Toggle v0.10.0's commit message
rate: prevent overflows when calculating durationFromTokens

Currently, there is a conversion from float64 to int64 when returning the duration needed to accumulate the required number of tokens.
When limiters are set with low limits, i.e. 1e-10, the duration needed is greater than math.MaxInt64.
As per the language specifications, in these scenarios the outcome is implementation determined.
This results in overflows on `amd64`, resulting in no wait, effectively jamming the limiter open.

Here we add a check for this scenario, returning InfDuration if the desired duration is greater than math.MaxInt64.

Fixes golang/go#71154

Change-Id: I775aab80fcc8563a59aa399844a64ef70b9eb76a
Reviewed-on: https://go-review.googlesource.com/c/time/+/641336
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>

v0.9.0

Toggle v0.9.0's commit message
rate: make function comment match function name

Change-Id: I603ca855eac736e90d2ba2bb7ce61981a4a91918
Reviewed-on: https://go-review.googlesource.com/c/time/+/638776
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>

v0.8.0

Toggle v0.8.0's commit message
README: don't recommend go get

These days people will just import the packages and the go tool will
do the right thing. We don't need to explain it.

Add a pointer to the git repo, though.

For golang/go#62645

Change-Id: I87fbf5d50e75120052f56ed6d4ac9977056cde9f
Reviewed-on: https://go-review.googlesource.com/c/time/+/624235
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>

v0.7.0

Toggle v0.7.0's commit message
x/time/rate: correctly handle 0 limits

Decrementing the burst in the reserveN method will frequently lead to us
setting the burst to 0 which makes the limiter mostly unusable.

This code was originally added in https://go.dev/cl/323429 to fix #39984
but the implementation introduced a different bug. To avoid regressing
to the behaviour described in #39984, pre-fill the limiter to the burst
value in the constructor.

Fixes #68541

Change-Id: Iab3b85d548a44fcb2d058336e5bbf11b19ea67b1
Reviewed-on: https://go-review.googlesource.com/c/time/+/600876
Reviewed-by: Sameer Ajmani <sameer@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Sameer Ajmani <sameer@golang.org>

v0.6.0

Toggle v0.6.0's commit message
LICENSE: update per Google Legal

Very minor tweaks:
 - Remove (c) pseudosymbol.
 - Remove "All Rights Reserved."
 - Change "Google Inc." (no longer exists) to "Google LLC".

[git-generate]
echo '
,s/\(c\) //
,s/ All rights reserved.//
,s/Google Inc./Google LLC/
w
q
' | sam -d LICENSE

Change-Id: Iaff5a0b4df05a69b33e2aa63f42e2476c255952d
Reviewed-on: https://go-review.googlesource.com/c/time/+/598529
Auto-Submit: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

v0.5.0

Toggle v0.5.0's commit message
rate: add documentation on Limiter concurrent usage

Closes golang/go#17261

Change-Id: Ifeacc8df45fb59e7781ddcc35c2fde0aa80188eb
Reviewed-on: https://go-review.googlesource.com/c/time/+/530855
Auto-Submit: Sameer Ajmani <sameer@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Sameer Ajmani <sameer@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载