From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: poffice@blade.nagaokaut.ac.jp Delivered-To: poffice@blade.nagaokaut.ac.jp Received: from kankan.nagaokaut.ac.jp (kankan.nagaokaut.ac.jp [133.44.2.24]) by blade.nagaokaut.ac.jp (Postfix) with ESMTP id 4D7B219C0535 for ; Mon, 30 Nov 2015 21:56:42 +0900 (JST) Received: from voscc.nagaokaut.ac.jp (voscc.nagaokaut.ac.jp [133.44.1.100]) by kankan.nagaokaut.ac.jp (Postfix) with ESMTP id 5756BB5D8F3 for ; Mon, 30 Nov 2015 22:28:00 +0900 (JST) Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by voscc.nagaokaut.ac.jp (Postfix) with ESMTP id E624F18CC7CC for ; Mon, 30 Nov 2015 22:28:00 +0900 (JST) Received: from [221.186.184.76] (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 1699B12049A; Mon, 30 Nov 2015 22:27:59 +0900 (JST) X-Original-To: ruby-core@ruby-lang.org Delivered-To: ruby-core@ruby-lang.org Received: from o2.heroku.sendgrid.net (o2.heroku.sendgrid.net [67.228.50.55]) by neon.ruby-lang.org (Postfix) with ESMTPS id 2588612046B for ; Mon, 30 Nov 2015 22:27:54 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sendgrid.me; h=from:to:references:subject:mime-version:content-type:content-transfer-encoding:list-id; s=smtpapi; bh=Hp42ZGIKttnnrcat5rEpxrbh95U=; b=dn4PCOcC0RXFSarkW3 aipiqFMDs7TCNbmZvc78tsFkT85D7Mp3Bzo566KnoOsh+bD8a3e2nxYa1WlyW4Cw j6ePaM0VAZNml8crviVGDGkWcTPfpsdd9G9nshJhGjQy1uP3q5xNp5pN/xAAY8u+ iJckTE6cnGFWONCaJsIlp+ORM= Received: by filter0475p1mdw1.sendgrid.net with SMTP id filter0475p1mdw1.14155.565C4ED57 2015-11-30 13:27:49.154082992 +0000 UTC Received: from herokuapp.com (ec2-54-82-47-117.compute-1.amazonaws.com [54.82.47.117]) by ismtpd0006p1iad1.sendgrid.net (SG) with ESMTP id 3ISQBYKCTCCJRFcxxWifow Mon, 30 Nov 2015 13:27:49.235 +0000 (UTC) Date: Mon, 30 Nov 2015 13:27:49 +0000 From: yasuhiro6194@gmail.com To: ruby-core@ruby-lang.org Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Redmine-MailingListIntegration-Message-Ids: 46441 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 11595 X-Redmine-Issue-Author: davidcelis X-Redmine-Issue-Assignee: akr X-Redmine-Sender: nkmrya X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-SG-EID: ync6xU2WACa70kv/Ymy4QrNMhiuLXJG8OTL2vJD1yS6yc7TgcB2LsN6HlBcQc0c7ySEgy/qs4BK5Q/ nPuxzuE58JzMQHcQibeecb/+Y4OKdanl9HgFKhMRQpV7Ho8M93HcMVW/LVFvZdVVdBG51dftETWbTU tyNdqmncrHTwiNtb1Qhn3sUjsdMuS8h7NHL7 X-ML-Name: ruby-core X-Mail-Count: 71754 Subject: [ruby-core:71754] [Ruby trunk - Bug #11595] Time#utc? and Time#gmt? return misleading results based on $TZ X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #11595 has been updated by Yasuhiro Nakamura. File time_utc.patch added Anyway I write a patch. Is it a bug? or specification? ---------------------------------------- Bug #11595: Time#utc? and Time#gmt? return misleading results based on $TZ https://bugs.ruby-lang.org/issues/11595#change-55166 * Author: David Celis * Status: Open * Priority: Normal * Assignee: Akira Tanaka * ruby -v: ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin14] * Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN ---------------------------------------- There is an issue with Time#utc? and its alias, Time#gmt?, that return misleading results based on the value of the TZ environment variable. It seems that the only way for a Time instance to return `true` for `utc?` is if you explicitly call `#utc` on it before: ~~~ ENV['TZ'] = 'UTC' # => "UTC" time = Time.now # => 2015-10-14 19:30:00 +0000 time.utc? # => false time = time.utc # => 2015-10-14 19:30:00 UTC time.utc? # => true ~~~ This seems misleading based on the value of $TZ being "UTC". The expected result for calling `Time.now.utc?` in this case would be `true`, as would that be expected for time zones that are considered links to "UTC" based on the [tzdata list](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). These include "UTC", "GMT", "Etc/UTC", "Etc/GMT", "Universal", etc. ---Files-------------------------------- time_utc.patch (927 Bytes) -- https://bugs.ruby-lang.org/