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 spec for Time::Location.load_local with TZ=nil #6740

Merged

Conversation

straight-shoota
Copy link
Member

On POSIX systems, if environment variable TZ is not set, Time::Location.load_local looks up the time zone setting in /etc/localtime. However, if this file is not available (or invalid), the default value UTC is used.
That breaks the spec, which assumes the return value to be always Local.

This is an issue when /etc/localtime is not populated by default which makes it depend on OS configuration.
The FreeBSD port contains a patch to disable this spec because it would fail on a clean install without time zone configured.

I changed the spec to pass when the returned location name is either Local or UTC.

Copy link
Member

@sdogruyol sdogruyol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CircleCI failures seems to be on their side. Thank you @straight-shoota 👍

@sdogruyol sdogruyol merged commit 5bc16fa into crystal-lang:master Sep 18, 2018
@sdogruyol sdogruyol added this to the 0.27.0 milestone Sep 18, 2018
@straight-shoota straight-shoota deleted the jm/fix/time-local-spec branch September 18, 2018 06:56
ezrast pushed a commit to ezrast/crystal that referenced this pull request Oct 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants