Closed
Description
Visual Studio 2013
double DateTime::ComputeCurrentTimestampInAmazonFormat()
{
std::chrono::duration<double, std::chrono::seconds::period> now = std::chrono::high_resolution_clock::now().time_since_epoch();
return now.count();
}
this returned 6-digit numbers in range ~265000 for me while current epoch time is a 10-digit number around 1446523779. In fact high_resolution_clock's epoch is it's host start time, hot Jan 1, 1970 (UNIX epoch), thus using its time_since_epoch in AWS timestamp comparisons makes no sense. To use UNIX epoch, system_clock should be used in place of high_resolution_clock.
For me this bug resulted in not refreshing temporary Cognito identity tokens upon their expiration because here:
bool CognitoCachingCredentialsProvider::IsTimeExpired(double expiry)
{
using namespace std::chrono;
//30s grace buffer so requests have time to finish before expiry.
static const double GRACE_BUFFER = 30.0;
return expiry < (Utils::DateTime::ComputeCurrentTimestampInAmazonFormat() - GRACE_BUFFER);
}
right side of a comparison was always less than 10-digit expiry epoch time returned by AWS server. I've checked that if I use system_clock the problem disappears.
Metadata
Metadata
Assignees
Labels
No labels