On Monday, 20 April 2020 16:23:10 UTC+1, David Finkel wrote:
>
>
>
> On Mon, Apr 20, 2020 at 11:02 AM <crate...@gmail.com <javascript:>> 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.
>

I was wondering if it had to with serialization. However, no time 
serialization takes place, as far as I can tell. The OAuth2 token is 
returned with a time to live (expires_in expressed as seconds). So the 
Expiry field is set with time.Now() + the time to live duration and 
subsequently compared with time.Now() (- a hard-coded clock skew 
adjustment)... so both should have monotonic clock readings and the 
comparison should be consistent (?).

-- 
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/36353def-1223-4302-9e34-2864cd5607fe%40googlegroups.com.

Reply via email to