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

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

Re: current-time in a loop


From: Anselm Helbig
Subject: Re: current-time in a loop
Date: Thu, 08 Dec 2005 15:46:39 +0100
User-agent: Wanderlust/2.15.1 (Almost Unreal) Emacs/22.0 Mule/5.0 (SAKAKI)

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


reply via email to

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