* inverse of float-time? @ 2013-09-11 17:39 Sam Steingold 2013-09-11 19:14 ` Paul Eggert 2013-09-12 3:07 ` SAKURAI Masashi 0 siblings, 2 replies; 11+ messages in thread From: Sam Steingold @ 2013-09-11 17:39 UTC (permalink / raw) To: emacs-devel Is it possible to convert the return value of float-time back to a list of integers? -- Sam Steingold (http://sds.podval.org/) on Ubuntu 13.04 (raring) X 11.0.11303000 http://www.childpsy.net/ http://www.memritv.org http://thereligionofpeace.com http://openvotingconsortium.org http://honestreporting.com http://camera.org Who is General Failure and why is he reading my hard disk? ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: inverse of float-time? 2013-09-11 17:39 inverse of float-time? Sam Steingold @ 2013-09-11 19:14 ` Paul Eggert 2013-09-11 19:31 ` Sam Steingold 2013-09-12 3:07 ` SAKURAI Masashi 1 sibling, 1 reply; 11+ messages in thread From: Paul Eggert @ 2013-09-11 19:14 UTC (permalink / raw) To: sds; +Cc: emacs-devel On 09/11/13 10:39, Sam Steingold wrote: > Is it possible to convert the return value of float-time back to a list > of integers? That's not easy to do now, but it'd be easy to add. We could add an optional argument to current-time, decoded just like float-time's argument is decoded, and current-time could convert it to a list of integers. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: inverse of float-time? 2013-09-11 19:14 ` Paul Eggert @ 2013-09-11 19:31 ` Sam Steingold 2013-09-12 1:52 ` Leo Liu 0 siblings, 1 reply; 11+ messages in thread From: Sam Steingold @ 2013-09-11 19:31 UTC (permalink / raw) To: emacs-devel > * Paul Eggert <rttreg@pf.hpyn.rqh> [2013-09-11 12:14:16 -0700]: > > On 09/11/13 10:39, Sam Steingold wrote: >> Is it possible to convert the return value of float-time back to a list >> of integers? > > That's not easy to do now, but it'd be easy to add. Please do! > We could add an optional argument to current-time, > decoded just like float-time's argument is decoded, > and current-time could convert it to a list of integers. Sounds good! It would also be nice if all functions which work with lists accepted floats too, e.g., `format-time-string'. -- Sam Steingold (http://sds.podval.org/) on Ubuntu 13.04 (raring) X 11.0.11303000 http://www.childpsy.net/ http://ffii.org http://jihadwatch.org http://camera.org http://truepeace.org http://palestinefacts.org http://think-israel.org Conscience is like a hamster: it is either asleep or gnawing. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: inverse of float-time? 2013-09-11 19:31 ` Sam Steingold @ 2013-09-12 1:52 ` Leo Liu 2013-09-12 3:44 ` Sam Steingold 0 siblings, 1 reply; 11+ messages in thread From: Leo Liu @ 2013-09-12 1:52 UTC (permalink / raw) To: sds; +Cc: emacs-devel On 2013-09-12 03:31 +0800, Sam Steingold wrote: >> That's not easy to do now, but it'd be easy to add. > > Please do! Doesn't seconds-to-time do what you want? Leo ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: inverse of float-time? 2013-09-12 1:52 ` Leo Liu @ 2013-09-12 3:44 ` Sam Steingold 2013-09-12 4:16 ` Paul Eggert 0 siblings, 1 reply; 11+ messages in thread From: Sam Steingold @ 2013-09-12 3:44 UTC (permalink / raw) To: emacs-devel > * Leo Liu <fqy.jro@tznvy.pbz> [2013-09-12 09:52:05 +0800]: > > On 2013-09-12 03:31 +0800, Sam Steingold wrote: >>> That's not easy to do now, but it'd be easy to add. >> >> Please do! > > Doesn't seconds-to-time do what you want? Ah, yes, it does. Thanks! However, what I want is for float time to be transparently accepted by all functions which accept list time. -- Sam Steingold (http://sds.podval.org/) on Ubuntu 13.04 (raring) X 11.0.11303000 http://www.childpsy.net/ http://ffii.org http://pmw.org.il http://truepeace.org http://openvotingconsortium.org The early worm gets caught by the bird. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: inverse of float-time? 2013-09-12 3:44 ` Sam Steingold @ 2013-09-12 4:16 ` Paul Eggert 2013-09-12 16:30 ` Ulrich Mueller 2013-09-17 20:03 ` Sam Steingold 0 siblings, 2 replies; 11+ messages in thread From: Paul Eggert @ 2013-09-12 4:16 UTC (permalink / raw) To: emacs-devel Sam Steingold wrote: > what I want is for float time to be transparently accepted by > all functions which accept list time. On second thought I'm not sure I want to encourage that. Floating-point loses information, due to rounding, and this can cause glitches that can make floating-point more trouble than it's worth. For example, if gettimeofday reports 1378930161.099999786 seconds after 1970, then current-time returns the exact representation (21040 52721 99999 786000) but float-time rounds this to 1378930161.1. Sure, it's a small error, but the fact that it's nonzero can cause problems. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: inverse of float-time? 2013-09-12 4:16 ` Paul Eggert @ 2013-09-12 16:30 ` Ulrich Mueller 2013-09-17 20:03 ` Sam Steingold 1 sibling, 0 replies; 11+ messages in thread From: Ulrich Mueller @ 2013-09-12 16:30 UTC (permalink / raw) To: Paul Eggert; +Cc: emacs-devel >>>>> On Wed, 11 Sep 2013, Paul Eggert wrote: > Sam Steingold wrote: >> what I want is for float time to be transparently accepted by >> all functions which accept list time. > On second thought I'm not sure I want to encourage that. > Floating-point loses information, due to rounding, and this can > cause glitches that can make floating-point more trouble than it's > worth. > For example, if gettimeofday reports 1378930161.099999786 seconds > after 1970, then current-time returns the exact representation > (21040 52721 99999 786000) but float-time rounds this to > 1378930161.1. Sure, it's a small error, but the fact that > it's nonzero can cause problems. Python also uses floating point numbers for time, and the error is large enough to lose three decimal digits for filesystem timestamps which have nanosecond precision. This is really awkward when one needs to compare timestamps for equality. (It's not surprising, because the IEEE 754 double format provides only 52 bits for the mantissa, whereas 31 + 30 = 61 bits are (currently!) needed to represent seconds and nanoseconds.) Ulrich ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: inverse of float-time? 2013-09-12 4:16 ` Paul Eggert 2013-09-12 16:30 ` Ulrich Mueller @ 2013-09-17 20:03 ` Sam Steingold 2013-09-17 21:10 ` Paul Eggert 1 sibling, 1 reply; 11+ messages in thread From: Sam Steingold @ 2013-09-17 20:03 UTC (permalink / raw) To: emacs-devel > * Paul Eggert <rttreg@pf.hpyn.rqh> [2013-09-11 21:16:22 -0700]: > > Sam Steingold wrote: >> what I want is for float time to be transparently accepted by >> all functions which accept list time. > > On second thought I'm not sure I want to encourage that. > Floating-point loses information, due to rounding, and > this can cause glitches that can make floating-point > more trouble than it's worth. So, what is the official use case for float time? When one would use it instead of time-date? It would seem that float-time should be either deprecated or granted equal rights :-) -- Sam Steingold (http://sds.podval.org/) on Ubuntu 13.04 (raring) X 11.0.11303000 http://www.childpsy.net/ http://thereligionofpeace.com http://think-israel.org http://memri.org http://www.PetitionOnline.com/tap12009/ http://dhimmi.com History doesn't repeat itself, but historians do repeat each other. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: inverse of float-time? 2013-09-17 20:03 ` Sam Steingold @ 2013-09-17 21:10 ` Paul Eggert 0 siblings, 0 replies; 11+ messages in thread From: Paul Eggert @ 2013-09-17 21:10 UTC (permalink / raw) To: sds; +Cc: emacs-devel On 09/17/13 13:03, Sam Steingold wrote: > float-time should be either deprecated or granted equal rights :-) It should be deprecated. float-time is based on assumptions that go back to the Good Old Days, when time stamps typically were 32-bit signed integer counts of seconds, possibly with an additional microseconds count. Under these assumptions float-time doesn't lose information on typical platforms with IEEE doubles, which are just barely large enough. Nowadays, though, time_t is often 64 bits, and timestamps are typically nanosecond resolution. IEEE doubles can't represent these time stamps without losing information, so float-time generates results with rounding errors. If we could assume Guile, I suppose we could represent these modern time stamps exactly, using fractions. That may be a good way to go in the future. It'd be a lot more convenient than the current list-of-integers representation. > So, what is the official use case for float-time? > When one would use it instead of time-date? I assume that it was put in to make it convenient to compare or subtract time stamps, or to add a time stamp to a seconds count. (You added float-time back in 2000, so you should know better than I. :-) These days, one should use time-less-p, time-subtract, and time-add, as they shouldn't have rounding errors. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: inverse of float-time? 2013-09-11 17:39 inverse of float-time? Sam Steingold 2013-09-11 19:14 ` Paul Eggert @ 2013-09-12 3:07 ` SAKURAI Masashi 2013-09-12 3:42 ` Sam Steingold 1 sibling, 1 reply; 11+ messages in thread From: SAKURAI Masashi @ 2013-09-12 3:07 UTC (permalink / raw) To: sds; +Cc: emacs-devel Hi, > Is it possible to convert the return value of float-time back to a list > of integers? I diagramed date and time conversions: https://cacoo.com/diagrams/lsA64PTazlLTbSwR I hope it would be useful for you. -- SAKURAI, Masashi (family, given) m.sakurai@kiwanami.net ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: inverse of float-time? 2013-09-12 3:07 ` SAKURAI Masashi @ 2013-09-12 3:42 ` Sam Steingold 0 siblings, 0 replies; 11+ messages in thread From: Sam Steingold @ 2013-09-12 3:42 UTC (permalink / raw) To: emacs-devel Hi, > * SAKURAI Masashi <z.fnxhenv@xvjnanzv.arg> [2013-09-12 12:07:15 +0900]: > >> Is it possible to convert the return value of float-time back to a list >> of integers? > > I diagramed date and time conversions: > > https://cacoo.com/diagrams/lsA64PTazlLTbSwR Interesting, thanks. What is "howm"? -- Sam Steingold (http://sds.podval.org/) on Ubuntu 13.04 (raring) X 11.0.11303000 http://www.childpsy.net/ http://americancensorship.org http://www.memritv.org http://www.PetitionOnline.com/tap12009/ http://memri.org What garlic is to food, insanity is to art. ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2013-09-17 21:10 UTC | newest] Thread overview: 11+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-09-11 17:39 inverse of float-time? Sam Steingold 2013-09-11 19:14 ` Paul Eggert 2013-09-11 19:31 ` Sam Steingold 2013-09-12 1:52 ` Leo Liu 2013-09-12 3:44 ` Sam Steingold 2013-09-12 4:16 ` Paul Eggert 2013-09-12 16:30 ` Ulrich Mueller 2013-09-17 20:03 ` Sam Steingold 2013-09-17 21:10 ` Paul Eggert 2013-09-12 3:07 ` SAKURAI Masashi 2013-09-12 3:42 ` Sam Steingold
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/emacs.git https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.