From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=AWL,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_BL_SPAMCOP_NET,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY shortcircuit=no autolearn=no autolearn_force=no version=3.4.2 Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by dcvr.yhbt.net (Postfix) with ESMTP id D78411F5AE for ; Wed, 22 Jul 2020 18:44:05 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id F3549120B21; Thu, 23 Jul 2020 03:43:30 +0900 (JST) Received: from xtrwkhkc.outbound-mail.sendgrid.net (xtrwkhkc.outbound-mail.sendgrid.net [167.89.16.28]) by neon.ruby-lang.org (Postfix) with ESMTPS id 4AEF2120B1C for ; Thu, 23 Jul 2020 03:43:29 +0900 (JST) Received: by filterdrecv-p3iad2-5b55dcd864-kvwkt with SMTP id filterdrecv-p3iad2-5b55dcd864-kvwkt-20-5F1888EC-26 2020-07-22 18:43:56.286357142 +0000 UTC m=+2252071.761227432 Received: from herokuapp.com (unknown) by ismtpd0019p1iad2.sendgrid.net (SG) with ESMTP id 5rMh7GE8QwCtD0zsalZY5A for ; Wed, 22 Jul 2020 18:43:56.261 +0000 (UTC) Date: Wed, 22 Jul 2020 18:43:56 +0000 (UTC) From: gamelinks007@gmail.com Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 75066 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Bug X-Redmine-Issue-Id: 17042 X-Redmine-Issue-Author: timcraft X-Redmine-Sender: S_H_ 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: =?us-ascii?Q?hkhH+VYi3CHo0H3puLbdQ20XoWHmZIf5UShlDYZVe94F=2FHCsK1VKgvJVjzu9bu?= =?us-ascii?Q?RWEgLMzYqNG3=2FrKqUzv5WnvYdzgvUXYwIf=2FuuvX?= =?us-ascii?Q?d1w0PjrSkzRnTKekH+FHvB9MPwRmCPziI0pJsMj?= =?us-ascii?Q?gvtzwPvMiuFp=2FJpmobYGHz8=2FYdDIbM85U4K1Zbo?= =?us-ascii?Q?jOSYK8rcmL6exDrujx3XW=2F3eiAsCPQVtJouCvz2?= =?us-ascii?Q?Z1oRtv+d0NIvEakd8=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 99277 Subject: [ruby-core:99277] [Ruby master Bug#17042] Times with timezones return incorrect week numbers 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #17042 has been updated by S_H_ (Shun Hiraoka). Apparently the calculation result `ret = ((timeptr->tm_yday + 7 - wday) / 7);` is negative(`timeptr->tm_yday` is negative). ```c static int weeknumber(const struct tm *timeptr, int firstweekday) { int wday = timeptr->tm_wday; int ret; if (firstweekday == 1) { if (wday == 0) /* sunday */ wday = 6; else wday--; } ret = ((timeptr->tm_yday + 7 - wday) / 7); if (ret < 0) ret = 0; return ret; } ``` ---------------------------------------- Bug #17042: Times with timezones return incorrect week numbers https://bugs.ruby-lang.org/issues/17042#change-86665 * Author: timcraft (Tim Craft) * Status: Open * Priority: Normal * ruby -v: ruby 2.8.0dev (2020-07-15 master 79d06483a8) * Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN ---------------------------------------- Times with timezones return incorrect week numbers from strftime. For example: $ irb -r tzinfo irb(main):001:0> Time.utc(2020, 7, 22, 12, 0, 0).strftime('%U %V %W') => "29 30 29" irb(main):002:0> Time.new(2020, 7, 22, 12, 0, 0, TZInfo::Timezone.get('America/New_York')).strftime('%U %V %W') => "00 00 00" Follow up to #17024 -- https://bugs.ruby-lang.org/