From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "Basil L. Contovounesios" Newsgroups: gmane.emacs.bugs Subject: bug#48298: Invalid time specification: encode-time((0 30 11 1 1 0 nil -1 nil)) Date: Sun, 09 May 2021 09:19:47 +0100 Message-ID: <87fsyw5nfg.fsf@tcd.ie> References: <83tunc8kv3.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="21841"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 48298@debbugs.gnu.org, =?UTF-8?Q?=D0=95=D0=B2=D0=B3=D0=B5=D0=BD=D0=B8=D0=B9_?= =?UTF-8?Q?=D0=9C=D0=B8=D1=85=D0=B0=D0=B9=D0=BB=D0=BE=D0=B2?= To: Eli Zaretskii , Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun May 09 10:20:26 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lfefp-0005Za-Po for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 09 May 2021 10:20:25 +0200 Original-Received: from localhost ([::1]:36876 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lfefo-0002bl-Rt for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 09 May 2021 04:20:24 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44036) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lfefS-0002bc-2P for bug-gnu-emacs@gnu.org; Sun, 09 May 2021 04:20:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:43440) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lfefR-0003hW-QJ for bug-gnu-emacs@gnu.org; Sun, 09 May 2021 04:20:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lfefR-00024C-L4 for bug-gnu-emacs@gnu.org; Sun, 09 May 2021 04:20:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: "Basil L. Contovounesios" Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 09 May 2021 08:20:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48298 X-GNU-PR-Package: emacs Original-Received: via spool by 48298-submit@debbugs.gnu.org id=B48298.16205483987934 (code B ref 48298); Sun, 09 May 2021 08:20:01 +0000 Original-Received: (at 48298) by debbugs.gnu.org; 9 May 2021 08:19:58 +0000 Original-Received: from localhost ([127.0.0.1]:54986 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lfefN-00023u-8t for submit@debbugs.gnu.org; Sun, 09 May 2021 04:19:58 -0400 Original-Received: from mail-wm1-f54.google.com ([209.85.128.54]:50770) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lfefL-00023i-97 for 48298@debbugs.gnu.org; Sun, 09 May 2021 04:19:56 -0400 Original-Received: by mail-wm1-f54.google.com with SMTP id n84so7490392wma.0 for <48298@debbugs.gnu.org>; Sun, 09 May 2021 01:19:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tcd.ie; s=google21; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=Wn+hW/vcdsfB/J9do2S35tcBlH6Jbg3co4RolXPXOxc=; b=aLT7K/UWoDeRzWNpfuBoeQd+HzNyXj5wcYf5j8wxSR+9At8jRb4cgt+lf8SPOqhwXx 6C/kz9L1g4cwSPm0fqN3y6zK6sKEZXP6on9IYw4RvaTnFi+sHR/VnkJUx+bxSmnzNguy s/9BKdNoEEXTzIgawEiarFdMEeQDJgiOjVrq+Wczn2C6IVcUMheVy6O9Oq9FupTZ+nKZ uPgx5GWvLlF7xE2dVANbJVehhEvtJDTetqmNvfJQLI7A95bE8pdn0m6FhPHxpKvufD3c bq3Jc28+7Sqa88h8klC7RVABHUWZsvgvnJD3inDy5VlV2o/M9EUuKQ7R4SjFL4uHC7an +dtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=Wn+hW/vcdsfB/J9do2S35tcBlH6Jbg3co4RolXPXOxc=; b=dva7Nl//P5DFVmewWUtTN+eP5tgAwcZ3CA8CZXHmHRrebndKYS7OTT819Su2C+F9On qD+9hJgIK8V4ErncrNnWd4D5sKhAt07GpCGqj6mg1h14VrzbVXSyAI7P7FYt8k760EH+ es5pUsLBVt4iHuwyEaKxzYEPZHn9Vfk0Df3tAau1Rvd4UoTCD2szYK+1c1zkAlD+Cdzr q9kdSr0vHZUypgilq7jH2K1J+xY8KQqM+sItBZx7iM0VQEGkXF/cG2DAKeKPJ0mT+LfK B7IYu0VUxnXCCjJaOJb0GhUiItBRlLD9QE8X4Pw4aCpPHF68nu3Kye1D6q/FGR8KBjvG D/Zw== X-Gm-Message-State: AOAM532PknOnLaVFBM8J8ZzAWCMui0/kSodJac1df4Mp8OSsm+ObJd/l st5F9IKc94ZZsiA9ck1DXq4Adw== X-Google-Smtp-Source: ABdhPJwBvY2Wl1QRVjctbAJ0rpAi+0ZGCQ5+HSMSrIdnyAFU4HHaw7VpozgCfoXvtD+5it1arhIq5w== X-Received: by 2002:a1c:14c:: with SMTP id 73mr15152610wmb.152.1620548389427; Sun, 09 May 2021 01:19:49 -0700 (PDT) Original-Received: from localhost ([2a02:8084:20e2:c380:f410:82e8:3a21:eedf]) by smtp.gmail.com with ESMTPSA id a15sm16728548wrr.53.2021.05.09.01.19.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 May 2021 01:19:48 -0700 (PDT) In-Reply-To: <83tunc8kv3.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 09 May 2021 09:46:56 +0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:206047 Archived-At: Eli Zaretskii writes: >> From: =D0=95=D0=B2=D0=B3=D0=B5=D0=BD=D0=B8=D0=B9 =D0=9C=D0=B8=D1=85=D0= =B0=D0=B9=D0=BB=D0=BE=D0=B2 >> >> Date: Sat, 8 May 2021 19:55:10 +0300 >>=20 >> (my-mins-between "11:30" "12:04") >>=20 >> (defun my-mins-between (time1 time2) >> "Return the minutes between HH:mm strings TIME1 and TIME2." >> (let ((diff (apply #'time-subtract >> (mapcar (lambda (time) >> (encode-time (decoded-time-set-defaults >> (parse-time-string time)))) >> (list time1 time2))))) >> (/ (float-time diff) 60))) >>=20 >> Debugger entered--Lisp error: (error "Invalid time specification") >> encode-time((0 30 11 1 1 0 nil -1 nil)) >> (lambda (time) (encode-time (decoded-time-set-defaults (parse-time-str= ing time))))("11:30") >> mapcar((lambda (time) (encode-time (decoded-time-set-defaults (parse-t= ime-string time)))) ("11:30" >> "12:04")) > > I guess the problem is in decoded-time-set-defaults, if anywhere. Lars? FWIW there is a similar pattern in the function iso8601--encode-time. BTW I just noticed that decoded-time-set-defaults was mistakenly announced in NEWS as encoded-time-set-defaults - should that be fixed on emacs-27 or master? > However, I'm not sure I understand the idea behind your > my-mins-between: how did you expect Emacs to guess the year you had in > mind? The year doesn't matter, since my-mins-between cares only about the relative difference between strings of the form "HH:mm", i.e. the hours and minutes fields. The other decoded time fields resulting from parsing don't matter, as long as they are equivalent for both strings. Thanks, --=20 Basil