On Mon, Apr 20, 2020 at 11:02 AM <craterm...@gmail.com> wrote: > Whoops, you're right. I got my Time and Duration mixed up. Your question > still stands, though. The section on Monotonic Clocks at > https://pkg.go.dev/time?tab=doc is a bit dense, but my best guess is that > stripping the monotonic clock reading from the Expiry ensures that the > comparison is made against the actual wall clock time (in the past) vs some > unknown adjusted time, which might be earlier or later than the intended > time and thus give incorrect results. > > (from the peanut gallery)
My guess is that it wouldn't be that the monotonic time is incorrect, (in fact it's probably more correct), it's just that it never gets serialized, so you get inconsistent results whether you check the expiration of the unserialized original struct, vs one you parsed if you compare using the monotonic clock. > s > > > On Monday, April 20, 2020 at 7:16:30 AM UTC-7, ISE Development wrote: >> >> On Monday, 20 April 2020 15:04:54 UTC+1, crate...@gmail.com wrote: >>> >>> According to https://golang.org/pkg/time/#Duration.Round "If m <= 0, >>> Round returns d unchanged". So now I'm really curious, why do the >>> Round() at all? >>> >> >> But in this case, it's a time.Time value, so this applies ( >> https://pkg.go.dev/time?tab=doc#Time.Round): >> >> Round returns the result of rounding t to the nearest multiple of d >>> (since the zero time). The rounding behavior for halfway values is to round >>> up. If d <= 0, Round returns t stripped of any monotonic clock reading but >>> otherwise unchanged. >> >> -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/f871298a-f06d-4e9f-ad20-ee145cdd8004%40googlegroups.com > <https://groups.google.com/d/msgid/golang-nuts/f871298a-f06d-4e9f-ad20-ee145cdd8004%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CANrC0Bjj_-M_q%2BuF30JsNGWq4M8OQO7rnwdktrtyAHj4g3FzNw%40mail.gmail.com.