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 D0F6819C0535 for ; Tue, 1 Dec 2015 01:24: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 DB2F4B5D931 for ; Tue, 1 Dec 2015 01:56:02 +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 A916818CC7B2 for ; Tue, 1 Dec 2015 01:56:02 +0900 (JST) Received: from [221.186.184.76] (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 4B8AF1205DA; Tue, 1 Dec 2015 01:55:59 +0900 (JST) X-Original-To: ruby-core@ruby-lang.org Delivered-To: ruby-core@ruby-lang.org Received: from o10.shared.sendgrid.net (o10.shared.sendgrid.net [173.193.132.135]) by neon.ruby-lang.org (Postfix) with ESMTPS id 90EEF120523 for ; Tue, 1 Dec 2015 01:55:55 +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=oEqnu85A3W1xFEoR1srXr0aejGY=; b=pnNGChuUfEE3iw4vS4 6W2fIBVH1ZwatzUoUNd66SumS4kTf1bwPmyuAjvgCMSWZfTmbg/rWD3jzKDtXBfR nbRl3WwOYjEER/ECQ1Uwbpp+Kqq2+tciqVjV1CWJsWxuupEvUxhMdXAvNciTd9Oe dLWpYJ/qF9Y6hHXzIou2gWsBQ= Received: by filter0563p1mdw1.sendgrid.net with SMTP id filter0563p1mdw1.22044.565C7F922E 2015-11-30 16:55:46.65934213 +0000 UTC Received: from herokuapp.com (ec2-54-82-47-117.compute-1.amazonaws.com [54.82.47.117]) by ismtpd0001p1iad1.sendgrid.net (SG) with ESMTP id FyTbyzePRy2P4q6GKpbYmA Mon, 30 Nov 2015 16:55:46.762 +0000 (UTC) Date: Mon, 30 Nov 2015 16:55:46 +0000 From: me@davidcel.is 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: 46446 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 11595 X-Redmine-Issue-Author: davidcelis X-Redmine-Issue-Assignee: akr X-Redmine-Sender: davidcelis 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/Ymy4QrNMhiuLXJG8OTL2vJD1yS6ScHiQvTywXOYfnYTze40BX5H4R8bWySrk9y YZvYKFR09NhwfuzfmKboNWNftAAfpy8esr7MLb4SJCxPx5s0ZJT7j5JVTz587HhLikAoaLFVgN7g7T nOc+jYXYiX6+3HOpwR0pnscry44cB8rg9tBL X-SendGrid-Contentd-ID: {"test_id":"1448902550"} X-ML-Name: ruby-core X-Mail-Count: 71759 Subject: [ruby-core:71759] [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 David Celis. Yasuhiro Nakamura wrote: > Anyway I write a patch. > > Is it a bug? or specification? To me it seems like a bug, since the expectation is that Time#utc? would return true for any time with an offset of 0 ---------------------------------------- Bug #11595: Time#utc? and Time#gmt? return misleading results based on $TZ https://bugs.ruby-lang.org/issues/11595#change-55169 * 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/