File: deadline.go

package info (click to toggle)
golang-github-getsentry-sentry-go 0.29.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,404 kB
  • sloc: makefile: 75; sh: 21
file content (22 lines) | stat: -rw-r--r-- 619 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package ratelimit

import "time"

// A Deadline is a time instant when a rate limit expires.
type Deadline time.Time

// After reports whether the deadline d is after other.
func (d Deadline) After(other Deadline) bool {
	return time.Time(d).After(time.Time(other))
}

// Equal reports whether d and e represent the same deadline.
func (d Deadline) Equal(e Deadline) bool {
	return time.Time(d).Equal(time.Time(e))
}

// String returns the deadline formatted for debugging.
func (d Deadline) String() string {
	// Like time.Time.String, but without the monotonic clock reading.
	return time.Time(d).Round(0).String()
}