ruby-dev (Japanese) list archive (unofficial mirror)
 help / color / mirror / Atom feed
From: zn@mbf•nifty.com
To: ruby-dev@ruby-lang.org
Subject: [ruby-dev:50642] [Ruby trunk Bug#15177] 起動した後にTZを変更するとTime#utcがずれることがある
Date: Sat, 29 Sep 2018 11:12:58 +0000 (UTC)	[thread overview]
Message-ID: <redmine.issue-15177.20180929111256.28a317fe1316bb5f@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-15177.20180929111256@ruby-lang.org

Issue #15177 has been reported by znz (Kazuhiro NISHIYAMA).

----------------------------------------
Bug #15177: 起動した後にTZを変更するとTime#utcがずれることがある
https://bugs.ruby-lang.org/issues/15177

* Author: znz (Kazuhiro NISHIYAMA)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux]
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN
----------------------------------------
起動時に `TZ` を `right/Asia/Tokyo` にしていると `Time#utc` でローカルタイムと同じ時分秒になりますが、 `TZ=Asia/Tokyo` で起動してから `ENV['TZ']='right/Asia/Tokyo'` で変更すると `Time#utc` の結果がうるう秒のぶんだけずれます。

```
$ TZ=Asia/Tokyo ruby -ve "ENV['TZ']='right/Asia/Tokyo';t=Time.at(2<<30);p t;p t.utc"
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux]
2038-01-19 12:13:41 +0900
2038-01-19 03:14:08 UTC
$ TZ=right/Asia/Tokyo ruby -ve "t=Time.at(2<<30);p t;p t.utc"
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux]
2038-01-19 12:13:41 +0900
2038-01-19 03:13:41 UTC
% TZ=Asia/Tokyo ruby -ve "t=Time.at(2<<30);p t;p t.utc"
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux]
2038-01-19 12:14:08 +0900
2038-01-19 03:14:08 UTC
```



-- 
https://bugs.ruby-lang.org/

       reply	other threads:[~2018-09-29 11:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <redmine.issue-15177.20180929111256@ruby-lang.org>
2018-09-29 11:12 ` zn [this message]
2018-10-09  2:10 ` [ruby-dev:50650] [Ruby trunk Bug#15177] 起動した後にTZを変更するとTime#utcがずれることがある naruse
2018-10-09  9:15 ` [ruby-dev:50651] " zn
2018-10-09  9:45 ` [ruby-dev:50652] " naruse
2018-10-09 13:04 ` [ruby-dev:50653] " nobu
2019-12-18  8:34 ` [ruby-dev:50895] [Ruby master " shyouhei
2019-12-18 14:03 ` [ruby-dev:50896] " nobu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.issue-15177.20180929111256.28a317fe1316bb5f@ruby-lang.org \
    --to=ruby-dev@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).