help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: even elder races get tired of waiting


From: Jean Louis
Subject: Re: even elder races get tired of waiting
Date: Mon, 22 Mar 2021 22:10:20 +0300
User-agent: Mutt/2.0.6 (2021-03-06)

* Emanuel Berg via Users list for the GNU Emacs text editor 
<help-gnu-emacs@gnu.org> [2021-03-22 21:30]:
> Jean Louis wrote:
> 
> > Maybe you should first define what is meant with
> > `days-from-date'. [...]
> 
> OK, well, hit me then, what should the definition be?
> 
> This is for practical use, how many days till my date with
> Sandra Bullock - because maybe some things need to be
> arranged? ... No? Okay, bad example

Is good example, would we be 30 years back in time. (This way the
warriors will not easily get a clue.)

> But it is also data for the sake of date because it is
> interesting at least to a "datadyrkare" like me
> (untranslatable Swedish pun), e.g. I did
> "Artificial Intelligence" at Uppsala University 2012-05-30,
> that was 8y 9m 20d ago.

For that I use `age' that again uses PostgreSQL:

(defun age (date)
  "Returns the age by using PostgreSQL. It is usable to find out
the age of people"
  (let* ((command (format "psql -Stc \"SELECT age(date('%s'));\"" date))
         (age (shell-command-to-string command))
         (age (string-trim age))
         (age (replace-regexp-in-string " mon " " month " age))
         (age (replace-regexp-in-string " mons " " months " age)))
    age))

(age "2012-05-30") → 8 years 9 months 23 days

I do trust the PostgreSQL and that would mean you have lost somewhere
those 3 days, who knows, maybe with Sandra in sauna.

> Now I used 'time-from' (zsh, not Elisp) BTW [1]

Maybe there is some bug in their function.

> 31! ??? Glitch in the Matrix?

I would not know any more, I have given you truthful evaluation on my
side. I was thinking maybe at specific time of the day it would show
one day more or less, and that it was that what is happening. Because
your function is not well understood on my side, I am simply skipping
it and relying on PostgreSQL calls.

> [1] https://dataswamp.org/~incal/conf/.zsh/time

> "Artificial Intelligence" at Uppsala University 2012-05-30,

$ datediff -f '%Yy %mm %dd %Hh %Mmin %Ss' 2012-05-30 2021-03-22 yields
  8y 9m 20d 0h 0min 0s and I understand that, but you lost somewhere 3
  days.

  Maybe you are discovering now bug in dateutils, or bug in PostgreSQL
  -- I just don't believe the latter.

  Leap years were 2020, 2016, maybe some days are missing because of
  that.

Jean





reply via email to

[Prev in Thread] Current Thread [Next in Thread]