unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Calc; Cannot add time units to date
@ 2018-03-22  8:36 Allen Li
  2018-03-22  9:36 ` Robert Pluim
  0 siblings, 1 reply; 7+ messages in thread
From: Allen Li @ 2018-03-22  8:36 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 259 bytes --]

Example repro:

1. emacs -Q
2. C-x * *
3. t N
4. ' 1.5hr RET
5. +

Expected:

1:  <2018-03-22 Thu 02:30>

Got:

1:  <2018-03-22 Thu 01:00> + 1.5 hr


Emacs  : GNU Emacs 27.0.50 (build 7, x86_64-pc-linux-gnu, GTK+ Version
3.22.28)
 of 2018-03-19
Package: Calc

[-- Attachment #2: Type: text/html, Size: 1233 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Calc; Cannot add time units to date
  2018-03-22  8:36 Calc; Cannot add time units to date Allen Li
@ 2018-03-22  9:36 ` Robert Pluim
  2018-03-22 17:38   ` Allen Li
  0 siblings, 1 reply; 7+ messages in thread
From: Robert Pluim @ 2018-03-22  9:36 UTC (permalink / raw)
  To: Allen Li; +Cc: emacs-devel

Allen Li <darkfeline@felesatra.moe> writes:

> Example repro:
>
> 1. emacs -Q
> 2. C-x * *
> 3. t N
> 4. ' 1.5hr RET
> 5. +
>
> Expected:
>
> 1:  <2018-03-22 Thu 02:30>
>
> Got:
>
> 1:  <2018-03-22 Thu 01:00> + 1.5 hr

Hmm, Iʼm not convinced thatʼs meant to work. Could you point me at a
section of the Calc manual that describes that?

As an alternative, you can use

1h30

to specify the time, but I suspect you knew that.

Robert



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Calc; Cannot add time units to date
  2018-03-22  9:36 ` Robert Pluim
@ 2018-03-22 17:38   ` Allen Li
  2018-03-22 20:16     ` Noam Postavsky
  0 siblings, 1 reply; 7+ messages in thread
From: Allen Li @ 2018-03-22 17:38 UTC (permalink / raw)
  To: emacs-devel

On Thu, Mar 22, 2018 at 2:36 AM, Robert Pluim <rpluim@gmail.com> wrote:
>
> Hmm, Iʼm not convinced thatʼs meant to work. Could you point me at a
> section of the Calc manual that describes that?

It's not in the manual, but I expected that it would work.  Is it
unreasonable to expect to be able to add time units to dates?



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Calc; Cannot add time units to date
  2018-03-22 17:38   ` Allen Li
@ 2018-03-22 20:16     ` Noam Postavsky
  2018-03-22 20:47       ` Allen Li
  0 siblings, 1 reply; 7+ messages in thread
From: Noam Postavsky @ 2018-03-22 20:16 UTC (permalink / raw)
  To: Allen Li; +Cc: Emacs developers

On 22 March 2018 at 13:38, Allen Li <darkfeline@felesatra.moe> wrote:
> On Thu, Mar 22, 2018 at 2:36 AM, Robert Pluim <rpluim@gmail.com> wrote:
>>
>> Hmm, Iʼm not convinced thatʼs meant to work. Could you point me at a
>> section of the Calc manual that describes that?
>
> It's not in the manual, but I expected that it would work.  Is it
> unreasonable to expect to be able to add time units to dates?

I think the point is that 1.5hr is not a time unit from Calc's point of view.

1.5hr + 1.5hour doesn't add together either.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Calc; Cannot add time units to date
  2018-03-22 20:16     ` Noam Postavsky
@ 2018-03-22 20:47       ` Allen Li
  2018-03-23  8:32         ` Robert Pluim
  0 siblings, 1 reply; 7+ messages in thread
From: Allen Li @ 2018-03-22 20:47 UTC (permalink / raw)
  To: Noam Postavsky; +Cc: Emacs developers

That's because hour is not a time unit.  hr is a time unit:

1.5 hr + 0.5 hr = 2. hr
1.5 hr + 30 min = 2. hr

(You need to press u s to simplify the units for the second example,
but this does nothing for the date arithmetic that is the subject of
this bug report.)

On Thu, Mar 22, 2018 at 1:16 PM, Noam Postavsky <npostavs@gmail.com> wrote:
> On 22 March 2018 at 13:38, Allen Li <darkfeline@felesatra.moe> wrote:
>> On Thu, Mar 22, 2018 at 2:36 AM, Robert Pluim <rpluim@gmail.com> wrote:
>>>
>>> Hmm, Iʼm not convinced thatʼs meant to work. Could you point me at a
>>> section of the Calc manual that describes that?
>>
>> It's not in the manual, but I expected that it would work.  Is it
>> unreasonable to expect to be able to add time units to dates?
>
> I think the point is that 1.5hr is not a time unit from Calc's point of view.
>
> 1.5hr + 1.5hour doesn't add together either.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Calc; Cannot add time units to date
  2018-03-22 20:47       ` Allen Li
@ 2018-03-23  8:32         ` Robert Pluim
  2018-03-23  8:41           ` Noam Postavsky
  0 siblings, 1 reply; 7+ messages in thread
From: Robert Pluim @ 2018-03-23  8:32 UTC (permalink / raw)
  To: Allen Li; +Cc: Noam Postavsky, Emacs developers

Allen Li <darkfeline@felesatra.moe> writes:

> That's because hour is not a time unit.  hr is a time unit:
>
> 1.5 hr + 0.5 hr = 2. hr
> 1.5 hr + 30 min = 2. hr
>
> (You need to press u s to simplify the units for the second example,
> but this does nothing for the date arithmetic that is the subject of
> this bug report.)

The way I read it, hr and min are units, and 't N' produces a
date. The documented way to add a time to a date is with '1h', which
works fine.

Robert



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Calc; Cannot add time units to date
  2018-03-23  8:32         ` Robert Pluim
@ 2018-03-23  8:41           ` Noam Postavsky
  0 siblings, 0 replies; 7+ messages in thread
From: Noam Postavsky @ 2018-03-23  8:41 UTC (permalink / raw)
  To: Emacs developers; +Cc: Allen Li

On 23 March 2018 at 04:32, Robert Pluim <rpluim@gmail.com> wrote:
> Allen Li <darkfeline@felesatra.moe> writes:
>
>> That's because hour is not a time unit.  hr is a time unit:

Ah, thanks, I was unaware of this.

>> 1.5 hr + 0.5 hr = 2. hr
>> 1.5 hr + 30 min = 2. hr
>>
>> (You need to press u s to simplify the units for the second example,
>> but this does nothing for the date arithmetic that is the subject of
>> this bug report.)
>
> The way I read it, hr and min are units, and 't N' produces a
> date. The documented way to add a time to a date is with '1h', which
> works fine.

Right, but it would be reasonable to unify the time units with dates.
If someone is looking for an elisp task...



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-03-23  8:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-22  8:36 Calc; Cannot add time units to date Allen Li
2018-03-22  9:36 ` Robert Pluim
2018-03-22 17:38   ` Allen Li
2018-03-22 20:16     ` Noam Postavsky
2018-03-22 20:47       ` Allen Li
2018-03-23  8:32         ` Robert Pluim
2018-03-23  8:41           ` Noam Postavsky

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).