From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fhigh-a6-smtp.messagingengine.com (fhigh-a6-smtp.messagingengine.com [103.168.172.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 60EC2429004 for ; Wed, 30 Sep 2026 19:54:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.157 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790798070; cv=none; b=TZJVAwEH98fZSIN8L8S9tp4UEQj5MpFerDTp2p+JFLfcORoOMSgkyXxb83kiL/7rPYkFYkIk8ok4JJy6pxgv4LsmGONmooiaByZ6MsekEWIapSACnlJ5735FChd+zgh4GUhpmua1nUzc0kRvN7wdvlVkLy0jNWcXdU0/5UCfH7k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790798070; c=relaxed/simple; bh=ZvmYbcu0e6lU4iyCOYMq2k8f595F67EFONdSKOvqEE8=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=n7FZnioybSTDk80O3JxQJqo9noVRCBHdPT75f2AXndKT2wJX6aQeqnYj+nxBpcz3BQsx0YOOW6mE/c+tm32S/MKww+nueuoiOOAvGerT1yS/xy6D2ohPYL0Y9MZDkt37pJS4LYhRsQsJCo4T5Y03u8//4BorkHkC033yVJ6DY5A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com; spf=pass smtp.mailfrom=pobox.com; dkim=pass (2048-bit key) header.d=pobox.com header.i=@pobox.com header.b=Q6/Ql7RF; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=tLdYfRgo; arc=none smtp.client-ip=103.168.172.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pobox.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pobox.com header.i=@pobox.com header.b="Q6/Ql7RF"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="tLdYfRgo" Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfhigh.phl.internal (Postfix) with ESMTP id 5AD901400090; Wed, 30 Sep 2026 15:54:28 -0400 (EDT) Received: from phl-frontend-01 ([10.202.2.160]) by phl-compute-04.internal (MEProxy); Wed, 30 Sep 2026 15:54:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pobox.com; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm3; t=1790798068; x=1790884468; bh=7BUBDfGner bU269fMdlE8zWYsqrkH6ml5+VdYLQzOMI=; b=Q6/Ql7RF57uBkpgV5KkL7Yj/gk kE00FOJmIwQJEqSTXUy8e+Rw2da+MSwa2rJNejPwZE23i2HZ2DZzmCyevm/2LvkP kxJySq1/yB+jv90dEsPCFTyY0xjcp0hUTZ2bBfEP4hIwFw8i4MZ4T/3JVpKxITa3 FxWGglbb/+PNLAbK6LxWurlUN7eceMhTS+zDxpDWVgj+r4GxJ7t+5r/Jk/RqbWpe VKVOFJsBdmaR6SJ7KZSd4F2qm9UCAbkuCuix8qqR7xOjUrzfgWIxBxLjmSqKM/mP Bf+qPbf/o4M2m4Cl5N97AGkA+v8EE0ZGdbrKyNt+Pb+fAbCwbddeNZCYNRJA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1790798068; x=1790884468; bh=7BUBDfGner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NEVdAm+ufEgswGxB5g X-ME-Proxy: Feedback-ID: if26b431b:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 30 Sep 2026 15:54:27 -0400 (EDT) From: Junio C Hamano To: Karthik Nayak Cc: Patrick Steinhardt , git@vger.kernel.org, Josh McKinney Subject: Re: [PATCH 1/3] date: add helpers to convert between "+HHMM" timezones and minutes In-Reply-To: (Karthik Nayak's message of "Wed, 30 Sep 2026 04:47:02 -0700") References: <20260929-pks-reftables-fix-timezone-format-v1-0-3df105a95ed1@pks.im> <20260929-pks-reftables-fix-timezone-format-v1-1-3df105a95ed1@pks.im> Date: Wed, 30 Sep 2026 12:54:26 -0700 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain Karthik Nayak writes: >> - int minutes; >> + int minutes = tz < 0 ? -tz : tz; > > This is the part which we could skip as we're C99 compliant, but keeping > to be on the safe side. > >> + minutes = (minutes / 100) * 60 + (minutes % 100); >> + return tz < 0 ? -minutes : minutes; >> +} I was wondering exactly the same thing yesterday. As written, it is clear even to those unfamiliar with the C89/C99 signed division rules, because we deal only with non-negative numbers, which is a plus. The fewer things readers need to worry about, the better. >> offset /= 60; /* in minutes */ >> - offset = (offset % 60) + ((offset / 60) * 100); >> - return offset * eastwest; >> + return minutes_to_tz(offset * eastwest); > > While mathematically it's the same, but shouldn't this have been > `minutes_to_tz(offset) * eastwest`? The way you suggest is more faithful rewrite of the original. Thanks.