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

"warning: Unrecognized time zone: x" emitted to stderr #2759

Closed
jmettraux opened this Issue Mar 25, 2015 · 4 comments

Comments

Projects
None yet
2 participants
@jmettraux
Copy link

jmettraux commented Mar 25, 2015

jruby 1.7.19 (1.9.3p551) 2015-01-29 20786bd on OpenJDK 64-Bit Server VM 1.6.0_34-b34 +jit [linux-amd64]

MRIs don't complain.

ENV['TZ'] = 'Pure/Invention'
Time.at(0)

  # => t.rb:3 warning: Unrecognized time zone: Pure/Invention
@headius

This comment has been minimized.

Copy link
Member

headius commented Apr 2, 2015

Confirmed. MRI must ignore it?

@headius

This comment has been minimized.

Copy link
Member

headius commented Apr 2, 2015

Ok, so I guess this is a difference in behavior because we don't use the same TZ functions as MRI. Here's part of the manpage for "tzset":

"""
The tzset() function initializes time conversion information used by the library routine localtime(3). The environment variable TZ specifies how this is done.

If TZ does not appear in the environment, the best available approximation to local wall clock time, as specified by the tzfile(5)-format file /etc/localtime, is used.

If TZ appears in the environment but its value is a null string, Coordinated Universal Time (UTC) is used (without leap second correction).

If TZ appears in the environment and its value begins with a colon (:'), the rest of its value is used as a pathname of a tzfile(5)-format file from which to read the time conversion information. If the first character of the pathname is a slash (/'), it is used as an absolute pathname; otherwise, it is used as a pathname relative to the system time conversion information directory.

If its value does not begin with a colon, it is first used as the pathname of a file (as described above) from which to read the time conversion information. If that file cannot be read, the value is then interpreted as a direct specification (the format is described below) of the time conversion information.

If the TZ environment variable does not specify a tzfile(5)-format file and cannot be interpreted as a direct specification, UTC is used.
"""

There's multiple things in there we don't support, like the special colon form, but the last line is key.

Now, what to fix...

It seems like it would be a nice-to-have feature in Ruby that it will tell you if you have a bogus TZ, doesn't it? Perhaps we should just make this into a verbose-mode warning?

@headius headius closed this in 7fe7ec3 Apr 2, 2015

@headius

This comment has been minimized.

Copy link
Member

headius commented Apr 2, 2015

I went with making the warning only happen in verbose mode. Let me know if you have any concerns.

headius added a commit that referenced this issue Apr 2, 2015

@headius headius added this to the JRuby 1.7.20 milestone Apr 2, 2015

@jmettraux

This comment has been minimized.

Copy link
Author

jmettraux commented Apr 2, 2015

Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.