Skip to content

Fix RemainingTime returning negative values#611

Merged
normj merged 1 commit intoaws:masterfrom
martincostello:Fix-LambdaContext-RemainingTime
Apr 2, 2020
Merged

Fix RemainingTime returning negative values#611
normj merged 1 commit intoaws:masterfrom
martincostello:Fix-LambdaContext-RemainingTime

Conversation

@martincostello
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member

normj commented Apr 3, 2020

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

@martincostello
Copy link
Copy Markdown
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