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 mFrsOeJTEWWnYAAAG6o9tA:P1 (envelope-from ) for ; Mon, 25 Sep 2023 11:33:23 +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 mFrsOeJTEWWnYAAAG6o9tA (envelope-from ) for ; Mon, 25 Sep 2023 11:33:23 +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 AC62633ECF for ; Mon, 25 Sep 2023 11:33:22 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=imBbduPx; 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=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1695634402; 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=vLWnkeu89Qp1CniXY+JWiw5LXb8xfBDrSLZh8wr2Lz8=; b=aL1OruTvrJFm3LhY8pwsyfcnv8TPP7xx3IuiyKEwuaU24MeFcLPGMJzCJficfd7rtnUhSd KsGT75sLmkx2YmAMLah4AgWRthNLtPow/N7JJOPbGXtOQIzpbIDIv+cFDKG9j45nSmb5g0 TwqmZb08JU/JKGyJNNagbRrTOu5AGE8KM+HQOsVZm6fd6RGsO2sHPJXMX3VygTJSyLJR2I uB5U/cWIKW2oC3CQgNKeRXNDFkRUWu9DzFR+q0Sd3xz5d/7wz8VeASaBK3+MogwNoc66nG dFAeoXqNHeALjrxNMXIfcovxBA+QdUkj3xrHNIxJnNFnL3lNwoMKdq9naFUbRg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=imBbduPx; 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=none) header.from=gmail.com ARC-Seal: i=1; s=key1; d=yhetil.org; t=1695634402; a=rsa-sha256; cv=none; b=eslq5qfMwtAOD2rbbOQAppkCpaT/wPKzwAb8yO6yPWcHCcicOSUiL1gRUbwRYm3VS46FJj fz4+dczK3vnjIay8xT6XWrm3XdqAf9RzUxzfYnFziBHiRxMQjFEVY87ENF9Ez3najLDkLj L4kN01N3CPbPuQiMI52bdikhaw/sRQ0OLzjcBlmwDHrPMgVwzoAvgz3+ePWHI6KwSpyFh3 n1CYAlQL6L+O4ROhFkw8X6TNzOeAZUU+T0Hc1wChY/5HkPK3OxJ2q7IJ+qVyYCG0qyu//E ZCXnvVCVYQoSA28VjwbQM16HlYk4wteMCnJT/xgi31n6YnjccAwyX79XQV3h+g== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qkhxJ-0000za-6F; Mon, 25 Sep 2023 05:32:41 -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 1qkhx9-0000zO-9A for emacs-orgmode@gnu.org; Mon, 25 Sep 2023 05:32:31 -0400 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qkhx3-0007vF-4b for emacs-orgmode@gnu.org; Mon, 25 Sep 2023 05:32:28 -0400 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-404fbfac998so67200025e9.3 for ; Mon, 25 Sep 2023 02:32:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695634341; x=1696239141; darn=gnu.org; h=mime-version:date:references:in-reply-to:subject:to:from:message-id :from:to:cc:subject:date:message-id:reply-to; bh=vLWnkeu89Qp1CniXY+JWiw5LXb8xfBDrSLZh8wr2Lz8=; b=imBbduPxtDUQ8yQN8qCzmI63E7z4y6lQ6lmtv6wjlwsYSlNkjE4RcOJ8fNrRxbbIqz mAaIbgoFsuzmZnzoulyydUBVzsX+IkcR37w/phaai7CbQckwq1gJwnRpmbzGd53ruoTL U011MQ3xEYe+W2bk0B9wIFBH4DjvXYeT2AqPPQ2Z9ys86zBdQvsq1U/rR40bXMe58DxK BihdY1V24UoUmhxajUUBgfzBTjA5m4CKkQKYvTe2dj2FGnFJH9cva+w4c/xuoYbt4eK9 WS/avR0BV9FWRed2hxLtS7MThVN0+5oq9W5ihz6tKEnJuaCFjsyBSmBvT1j5mG0czMuz dtig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695634341; x=1696239141; h=mime-version:date:references:in-reply-to:subject:to:from:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=vLWnkeu89Qp1CniXY+JWiw5LXb8xfBDrSLZh8wr2Lz8=; b=SmYCIkVPhbplEauCB6rJtXRp+vfwnsHkOpc6a+64vgnxT/gESOVx1QCWZOs5/H5D6d UXqPqIPK9eZK+zkYjGrXAzj/T3IQi0L7oqWaUkFbJutqURZhqbeQR9ffylOxANIfWjJT 8Um6RxoGVjKIVn0S5FrV1jGwQVhK4+9Jd0kUGkk7kttQby/dwExx6Vjakc4VObd/hwwU x8WA5ar3jRiqQE0oMgaxZq1GyLxUwLSPYlDFgRbgdat8lxwoe2bLyYZs8AqQMvz2xUDP 7nNd7MVS+v098dfmwuCQ4UZL470mx2LsONYD3j7Lj4Xz4UrbvmslIFjHpimrvEWcVdIe j9fQ== X-Gm-Message-State: AOJu0YwGY0PCUVida0IIysVBV5VYCfKzU1vMt8aFGsUOkgBJbPuP9xfu iSts3SqBlK9pWXABVZcw4tLP+qYweaw= X-Google-Smtp-Source: AGHT+IGf5OfBJZ8Uzg7g5eyAW6NiSlI3uJ85zz6+WplDHL2tkYFSI/Mw0T7GPUr20TUCgRaWgEI9Pw== X-Received: by 2002:a05:600c:2187:b0:403:cc79:44f3 with SMTP id e7-20020a05600c218700b00403cc7944f3mr5859484wme.19.1695634340416; Mon, 25 Sep 2023 02:32:20 -0700 (PDT) Received: from keynux ([2a01:e0a:505:3460:169:7511:f49a:58eb]) by smtp.gmail.com with ESMTPSA id t24-20020a7bc3d8000000b00401dc20a070sm14594432wmj.43.2023.09.25.02.32.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 02:32:20 -0700 (PDT) Message-ID: <651153a4.7b0a0220.f4676.c846@mx.google.com> Received: by keynux (sSMTP sendmail emulation); Mon, 25 Sep 2023 11:32:18 +0200 From: Bruno Barbier To: Chris Keschnat , emacs-orgmode@gnu.org Subject: Re: Calc/TBLFM: how to conditionally insert hours:minutes? In-Reply-To: <87pm28llcu.fsf@catsu.it> References: <87pm28llcu.fsf@catsu.it> Date: Mon, 25 Sep 2023 11:32:18 +0200 MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=brubar.cs@gmail.com; helo=mail-wm1-x331.google.com 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, FREEMAIL_FROM=0.001, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=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: -8.52 X-Migadu-Scanner: mx2.migadu.com X-Migadu-Queue-Id: AC62633ECF X-Spam-Score: -8.52 X-TUID: OJNarNRo0o4R Hi Chris, Chris Keschnat writes: > > | 19:55:00 | > | 00:00:40 | > | 00:00:40 | > #+TBLFM: $1=if(@# <= 1, 19:55, 40:01);T > > What would be the correct way to do this? > It seems that org tries to convert times back and forth when evaluating formulas; but, in your case, it cannot convert them because it doesn't spot them inside your formula. 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 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 Bruno