Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix RemainingTime returning negative values #611

Merged
merged 1 commit into from
Apr 2, 2020
Merged

Fix RemainingTime returning negative values #611

merged 1 commit into from
Apr 2, 2020

Conversation

martincostello
Copy link
Contributor

@martincostello martincostello commented Apr 1, 2020

Fix LambdaContext.RemainingTime returning negative values in a local time zone east of UTC due to local time being used for Unix epoch and clock.

This was working as expected for the last few months in some tests we had that run on our local developer machines, but since the UK moved to British Summer Time (UTC+1), the RemainingTime property is now returning a value approximately equal to -1 hour.

This PR fixes that by explicitly specifying that the Unix Epoch is in UTC, rather than the default of DateTimeKind.Unspecified, and then uses UtcNow instead of Now.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Fix LambdaContext.RemainingTime returning negative values in a local time zone east of UTC due to local time being used for Unix epoch and clock.
@klaytaybai klaytaybai added the bug This issue is a bug. label Apr 1, 2020
@klaytaybai klaytaybai self-requested a review April 1, 2020 16:55
@normj
Copy link
Member

normj commented Apr 2, 2020

Thanks for the fix. I'll get this released soon.

@normj normj merged commit a5f2e64 into aws:master Apr 2, 2020
@martincostello martincostello deleted the Fix-LambdaContext-RemainingTime branch April 2, 2020 17:56
@normj
Copy link
Member

normj commented Apr 3, 2020

Version 1.1.1 of Amazon.Lambda.RuntimeSupport is out with this fix. Thanks again.

@martincostello
Copy link
Contributor Author

Thanks @normj!

martincostello added a commit to martincostello/lambda-test-server that referenced this pull request Apr 3, 2020
Update Amazon.Lambda.RuntimeSupport to pick up bug fix from aws/aws-lambda-dotnet#611.
martincostello added a commit to martincostello/alexa-london-travel that referenced this pull request Apr 3, 2020
Update Amazon.Lambda.RuntimeSupport to pick up bug fix from aws/aws-lambda-dotnet#611.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants