From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:306:2d92::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id QFLWD7HGEWX0uwAAG6o9tA:P1 (envelope-from ) for ; Mon, 25 Sep 2023 19:43:13 +0200 Received: from aspmx1.migadu.com ([2001:41d0:306:2d92::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id QFLWD7HGEWX0uwAAG6o9tA (envelope-from ) for ; Mon, 25 Sep 2023 19:43:13 +0200 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 aspmx1.migadu.com (Postfix) with ESMTPS id 4A5CA41F7B for ; Mon, 25 Sep 2023 19:43:12 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=catsu.it header.s=mail header.b=55s4DsVi; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=quarantine) header.from=catsu.it ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1695663792; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=suoW4rqHbYCzH7YxZTN3fF7E1spU/HsCfhUubmRvgNU=; b=t4EwZgJV3a/7h3/PAHvhTyO5oyp4EmZYyUwP6p26a+1dSTigBuEyF0mQg9zzFMgyQco4lo Ka7EWGyqBzFa1l5YxYlOvcsTN1/LBfnIeZTNqZKKgnn/hWGYUvQ/KDlPoOdCW5u5OhssEg lbInj0maos0x6sGNGFVzsGPwCI6Mhp1lqRMX8x+n6xlYZsXeAakEC4pMIwrCh2GMH302Oc uH0kQ1FerxyIxC6z0ke4PILbD0bshzhm8+i4a6Hi0Jp3HJ34YnlqGeCufP8pHlyElAvR4y 9B6H9tKvoSSOITPctKaQc1YzCEhK0ftdi9ifp/b4rmri77FJwGp8sClltA3PMA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=catsu.it header.s=mail header.b=55s4DsVi; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=quarantine) header.from=catsu.it ARC-Seal: i=1; s=key1; d=yhetil.org; t=1695663792; a=rsa-sha256; cv=none; b=XuCLVxbsM+xI5B/ZEcEoWHf0AJceQav+uT5Mi2IZ+gdQpK/nxbLfSd2+0YfHDC3Gh3E8Xw 2uceUN6zHENw5PruJjrLY6miCqShXqzLAE8oEj3k1O/xcv0876Q8gwagyKuVwk+i7oJOoI UrIBVRY69Zr0X79lPtM7MC9sAxjh8CckrP9lbYFQ7Wivlm5WmUQ8Drp0y9M246oD6Rzyry psu0ROAeq8RbpvM5qySiTI8O9m9cdXiExra0qCCJq6CeQ3+dpNiUsg30OXiaZNwGO2vFwB 80FamFhDJZEnCnSZHjaJEtVXwU8IorOKcPYVOidUzJMstucAeQ/6ddgC8vGb7Q== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qkpbA-0002Ep-6g; Mon, 25 Sep 2023 13:42:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qkpb7-0002EM-KJ for emacs-orgmode@gnu.org; Mon, 25 Sep 2023 13:42:17 -0400 Received: from box.catsu.it ([46.232.250.231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qkpb5-0007kU-GI for emacs-orgmode@gnu.org; Mon, 25 Sep 2023 13:42:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=catsu.it; s=mail; t=1695663731; bh=CGiiK/AwQ+KnfUkM68cMHzRbVFR3kot5lRjF+PCDC+g=; h=References:From:To:Subject:Date:In-reply-to:From; b=55s4DsViA4A/ZjKhlamLicKS7W/B18c/I+5cge3YoAeemppTT2ZMPxrn/yBp/S0SV SGTBLtTfDOrDglQLBDkpcf46mPdfxmmTcnAcpbKklzMg0XBEu7QiytUYadl+zWwiFs c6PXcw0kVp64iZf6X6HMY4aGSToO5rWp3oVjQOElIvWjl/FMKcD3Vm07Oht9o/1M7/ Q+oZqy5gprnN04ksujQNT/aGEhJtuDeBUVzZ+SeE5RMwS1BxcEmovKxK9pnbxFHmoP 3qPJifXK658wNnfHD0/0hBwmIeU2XmKPyhFvek18sqlx1/KGzcA4H+9r5IVBpIcr82 yiUP5ttkxS3hQ== Received: from authenticated-user (box.catsu.it [46.232.250.231]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by box.catsu.it (Postfix) with ESMTPSA id 3EBC74A2CE for ; Mon, 25 Sep 2023 19:42:11 +0200 (CEST) References: <87pm28llcu.fsf@catsu.it> <651153a4.7b0a0220.f4676.c846@mx.google.com> From: Chris Keschnat To: emacs-orgmode@gnu.org Subject: Re: Calc/TBLFM: how to conditionally insert hours:minutes? Date: Mon, 25 Sep 2023 19:36:53 +0200 In-reply-to: <651153a4.7b0a0220.f4676.c846@mx.google.com> Message-ID: <87r0mmb159.fsf@catsu.it> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=46.232.250.231; envelope-from=chris@catsu.it; helo=box.catsu.it X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_FAIL=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -4.89 X-Migadu-Scanner: mx2.migadu.com X-Migadu-Queue-Id: 4A5CA41F7B X-Spam-Score: -4.89 X-TUID: ruPcWVZxyCrO Hi Bruno, > You could switch to the "Lisp" syntax (as opposed to the "Calc" syntax), > and, write the conversion manually: > > | 19:55:00 | > | 40:01:00 | > | 40:01:00 | > > #+TBLFM: $1='(org-table-time-string-to-seconds (if (<= @# 1) "19:55" "40:01"));T awesome, thank out. This works as expected with the little addendum that @# in Calc seems to ignore the header line (not present in this example), but the Lispy syntax doesn't. So the 1 in the "if" becomes a 2. > Note that, for Calc, 'X:Y' means the fraction 'X/Y' of the two > integers X and Y: > > 40:01 = 40/1 = 40 > 40:02 = 40/2 = 20 > 40:03 = 40/3 > 40:04 = 40/4 = 10 This also explains why 40:00 errors out :) Thanks a lot Chris