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-ASN: AS22989 209.51.188.0/24 X-Spam-Status: No, score=-3.7 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id C42E71F45A for ; Mon, 12 Aug 2019 15:02:58 +0000 (UTC) Received: from localhost ([::1]:46262 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hxBqb-0007nG-Ea for normalperson@yhbt.net; Mon, 12 Aug 2019 11:02:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39704) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hxBqX-0007n9-Bf for bug-gnulib@gnu.org; Mon, 12 Aug 2019 11:02:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hxBqW-0002hP-AN for bug-gnulib@gnu.org; Mon, 12 Aug 2019 11:02:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33184) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hxBqW-0002gy-51 for bug-gnulib@gnu.org; Mon, 12 Aug 2019 11:02:52 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9084A30BBE89 for ; Mon, 12 Aug 2019 15:02:50 +0000 (UTC) Received: from nbkamil.localnet (unknown [10.43.7.226]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3E1597CD8D for ; Mon, 12 Aug 2019 15:02:50 +0000 (UTC) From: Kamil Dudka To: bug-gnulib@gnu.org Subject: parse-datetime: invalid date range shifted by 30 minutes for Singapore TZ Date: Mon, 12 Aug 2019 17:02:49 +0200 Message-ID: <5561358.m8t0RcemEn@nbkamil> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Mon, 12 Aug 2019 15:02:50 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 X-BeenThere: bug-gnulib@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Gnulib discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Sender: "bug-gnulib" In 1981, there was a change in TZ for Singapore and Malaysia which went fro= m=20 UTC+7.5 to UTC+8. It happened at 1981-12-31 23:30:00 which became 1982-01-= 01=20 00:00:00. As I understand it, the range 1981-12-31 23:30:00 .. 1981-12-31 23:59:59=20 should be invalid, whereas the range 1982-01-01 00:00:00 .. 1982-01-01=20 00:29:59 should be valid. GNU date sees it exactly opposite. I do not fully understand the code of gnulib's parse-datetime.y -- mktime_z= ()=20 converts 1982-01-01 00:00:00 to 1981-12-31 23:30:00 and the subsequent call of mktime_ok() returns false, causing the failure. Minimal example: $ TZ=3DAsia/Singapore date --debug -d 1982-01-01 date: parsed date part: (Y-M-D) 1982-01-01 date: input timezone: TZ=3D"Asia/Singapore" environment value date: warning: using midnight as starting time: 00:00:00 date: error: invalid date/time value: date: user provided time: '(Y-M-D) 1982-01-01 00:00:00' date: normalized time: '(Y-M-D) 1981-12-31 23:30:00' date: ---- -- -- -- -- date: possible reasons: date: invalid day/month combination; date: numeric values overflow; date: missing timezone date: invalid date =E2=80=981982-01-01=E2=80=99 Original reported at https://bugzilla.redhat.com/1739747 . Kamil