unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* current-time in a loop
@ 2005-12-08 14:01 PT
  2005-12-08 14:46 ` Anselm Helbig
  0 siblings, 1 reply; 2+ messages in thread
From: PT @ 2005-12-08 14:01 UTC (permalink / raw)


current-time returns a list (HIGH LOW MICROSEC)

If I run it from a loop and leave it running for a few seconds only the
last element is incremented according to the output in the Messages
buffer:

(while t
  (princ (current-time))
  (princ "\n"))


(17304 15330 601809)
(17304 15330 601836)
(17304 15330 601863)
(17304 15330 601889)
(17304 15330 601916)


Why is that?

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

* Re: current-time in a loop
  2005-12-08 14:01 current-time in a loop PT
@ 2005-12-08 14:46 ` Anselm Helbig
  0 siblings, 0 replies; 2+ messages in thread
From: Anselm Helbig @ 2005-12-08 14:46 UTC (permalink / raw)


hi pt!

At 8 Dec 2005 06:01:18 -0800,
PT wrote:
> 
> current-time returns a list (HIGH LOW MICROSEC)
> 
> If I run it from a loop and leave it running for a few seconds only the
> last element is incremented according to the output in the Messages
> buffer:
> 
> (while t
>   (princ (current-time))
>   (princ "\n"))
> 
> 
> (17304 15330 601809)
> (17304 15330 601836)
> (17304 15330 601863)
> (17304 15330 601889)
> (17304 15330 601916)
> 
> 
> Why is that?

that's because emacs is so blindingly fast. 8;-) do a 

(while t
  (princ (current-time))
  (sit-for 1)
  (princ "\n"))

and you will see the seconds incrementing. i guess, the printing takes
more time than the loop, and the output is buffered in a way... 

regards, 

anselm

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

end of thread, other threads:[~2005-12-08 14:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-08 14:01 current-time in a loop PT
2005-12-08 14:46 ` Anselm Helbig

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).