From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.devel Subject: Re: Support for sub-second time in decoded time Date: Mon, 29 Jul 2019 16:12:34 +0200 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="245297"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jul 29 16:12:48 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hs6ON-0011gh-8X for ged-emacs-devel@m.gmane.org; Mon, 29 Jul 2019 16:12:47 +0200 Original-Received: from localhost ([::1]:52486 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hs6OL-0000Lp-Oi for ged-emacs-devel@m.gmane.org; Mon, 29 Jul 2019 10:12:45 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52936) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hs6OH-0000Li-Pu for emacs-devel@gnu.org; Mon, 29 Jul 2019 10:12:42 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hs6OG-0002tg-Ia for emacs-devel@gnu.org; Mon, 29 Jul 2019 10:12:41 -0400 Original-Received: from quimby.gnus.org ([80.91.231.51]:39002) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hs6OG-0002t7-CG for emacs-devel@gnu.org; Mon, 29 Jul 2019 10:12:40 -0400 Original-Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=stories) by quimby.gnus.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hs6OB-0002jR-7x; Mon, 29 Jul 2019 16:12:37 +0200 Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAElBMVEWqra7Z2tr////+//75 +fnt7e0mEygKAAACcUlEQVQ4jXVUy5KjMAyUM3CXAr6H1z0kzB2CfLcT9P+/sm2Y1NZma3wyaqvV kttQ+8uiX4GGnh+hXg9AHsd3pz8b2x47cP6Jh7Dum2GzVwYuXwcQVDVs2IzfanuGe+znc9zGR2ba duCyFw+brrq8NvBWm6bHDuCjN5t09RZ8OzgLihANBuLFZNPJB0236FwYqj2Dnr2E5HVBRnoyM23+ p3OEkmzJNls8RXbOHUAvZolIABiTiHMQlIHBiyUwSC2JiWcmCKIEtWbbzELuZUZOUqSc8YDowSwy TlZmjrw4Ag8oy7ZL4B5x0BZiLgvKxZt6fvZZjAiRi6gRhTE/Gi++VE3IvCIKFodqp0zVVLypUozj FcogVZjzrJJcU6kriS89UYl+Ysw9kM1NTZtSURQ4fWoTksp2pxKJRXCl5OMgb8ifjjuXOVGAzHm5 8il7YXdBrgGxULMsSTgbQA+XyGhVSVApImkG0HW3++3W0lKfzzXGRkWJEWJwzI5d0VJ1OtfCNCPF VwyOy5WYypZOVeJ5JAyr/hJ6A8jwC8ckpBNJOku+tkknmDLLlNJR1t8IptrOUkiJDFp8hcHClbFs stNmKikXJ1+I1Gw36HG5jfgGasQdazZyd1im9j4DiJfGGpDSShpTssW0bim6qkDLOmWnY+boFX5B hoHLM6tOGJ07AJZTS98xWrHM2q14N2dOMGJscvE2OaREZOjHqx2YVhfXvl9vH885OX9Oqut6G9TU 7uuk/Q70WcX6WBVTea+v3dSB2Yfwt8TlDXTT674/ZLMQtqDBp+c/v4xL7i17keCWj39JQ7zX+A/o 7vf7pFu+qPaX9Qf/wZ/svmEzWwAAAABJRU5ErkJggg== In-Reply-To: (Stefan Monnier's message of "Mon, 29 Jul 2019 10:03:30 -0400") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 80.91.231.51 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:238996 Archived-At: Stefan Monnier writes: >> `current-time' returns its data as (HIGH LOW USEC PSEC), but now that we >> have bignum support, perhaps we don't need to do it this way. What >> about just having a field in decoded times that's the fraction of a >> second? So 34.5603 seconds would be represented as >> >> (34 ... 5603) > > `encode-time` uses a fraction-representation (NOM . DENOM), which is > probably easier to manipulate. You mean internally? It doesn't seem to be mentioned in the doc string, but it's an entire essay now... > [ Note: I find `encode-time` vs `decode-time` very confusing. ] I think the pair makes sense on the same level as {decode,encode}-coding-string does. That is, encoded time is what Emacs uses internally for most things, and decoded time is pretty close to what you er find in nature. Or at least it used to be; `endode-time' has gotten really complicated lately, and the doc string doesn't seem to be correct, ether, for some of the more odd things it apparently does. (let ((time (current-time))) (equal time (encode-time time))) =3D> t (encode-time) -> Debugger entered--Lisp error: (wrong-number-of-arguments encode-time 0) But if we ignore all that, it's still conceptually sound. :-) --- encode-time is a built-in function in =E2=80=98src/timefns.c=E2=80=99. (encode-time &optional TIME FORM &rest OBSOLESCENT-ARGUMENTS) Probably introduced at or before Emacs version 19.29. This function does not change global state, including the match data. Convert optional TIME to a timestamp. Optional FORM specifies how the returned value should be encoded. This can act as the reverse operation of =E2=80=98decode-time=E2=80=99, whi= ch see. If TIME is a list (SECOND MINUTE HOUR DAY MONTH YEAR IGNORED DST ZONE) it is a decoded time in the style of =E2=80=98decode-time=E2=80=99, so that= (encode-time (decode-time ...)) works. TIME can also be a time value. See =E2=80=98format-time-string=E2=80=99 for the various forms of a time va= lue. For example, an omitted TIME stands for the current time. --- --=20 (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no