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 0D37F19C001B for ; Thu, 15 Oct 2015 04:08:05 +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 08483B5D8EE for ; Thu, 15 Oct 2015 04:34:15 +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 E842F95241E for ; Thu, 15 Oct 2015 04:34:14 +0900 (JST) Received: from [221.186.184.76] (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 9AE1312046A; Thu, 15 Oct 2015 04:34:11 +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 EFF0E120439 for ; Thu, 15 Oct 2015 04:34:07 +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=cAWCeaaD8Dna1R/wBsNPN9qV53Y=; b=kTZeRyJBj5vh0uPMlc dQYUZcPPvV65CH/aUKyXgH2zxoGgRXAWKrGWEdgTd1HGDXzrWygQAk9uQYAavdmG 73VnKwbPGfu/2YFlxrnwJMwvnXGJBC815Vzx/bz/VqrPcG75+cIPFUoanw7iCqMa ZIyAi4OU8ohIf+JSMG7L6eGxU= Received: by filter0568p1mdw1.sendgrid.net with SMTP id filter0568p1mdw1.21791.561EAE2923 2015-10-14 19:34:01.308123789 +0000 UTC Received: from herokuapp.com (ec2-54-166-39-162.compute-1.amazonaws.com [54.166.39.162]) by ismtpd0006p1iad1.sendgrid.net (SG) with ESMTP id H8p9Bq4QQuyuc2wpxIupcA for ; Wed, 14 Oct 2015 19:34:01.240 +0000 (UTC) Date: Wed, 14 Oct 2015 19:34:01 +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: 45710 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 11595 X-Redmine-Issue-Author: davidcelis 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/Ymy4QrNMhiuLXJG8OTL2vJD1yS7BqofbCJ03V2POKgdRvk/rNCWpxV4YCkMnwA 8VwYat6mC6JZ+oTelweNGu5ArBMh1aAw1vQpsmqrHXliaBvCEovL4DH/qcYTvbusVreDJBtOJ5tiax oZFltua/qwbtT2fbC5veFLJILvunXi684MWk X-ML-Name: ruby-core X-Mail-Count: 71089 Subject: [ruby-core:71089] [Ruby trunk - Bug #11595] [Open] 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 reported by David Celis. ---------------------------------------- Bug #11595: Time#utc? and Time#gmt? return misleading results based on $TZ https://bugs.ruby-lang.org/issues/11595 * Author: David Celis * Status: Open * Priority: Normal * Assignee: * 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. -- https://bugs.ruby-lang.org/