class Google::Auth::GCECredentials
def adjust_for_stale_expires_in hash, retrieval_time
We also ensure expires_in is conservative; subtracting at least 1
stale. Update it based on the time since the data was retrieved.
The response might have been cached, which means expires_in might be
def adjust_for_stale_expires_in hash, retrieval_time return unless hash["expires_in"].is_a? Numeric offset = 1 + (Process.clock_gettime(Process::CLOCK_MONOTONIC) - retrieval_time).round hash["expires_in"] -= offset if offset.positive? hash["expires_in"] = 0 if hash["expires_in"].negative? end