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

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

Re: Minibuffer tray to display current time and date


From: tomas
Subject: Re: Minibuffer tray to display current time and date
Date: Sun, 26 Apr 2015 17:52:36 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sun, Apr 26, 2015 at 05:48:13PM +0300, Eli Zaretskii wrote:

> It's not a problem with system load, it's a problem with _when_ within
> the minute does the timer run.  Scheduling it to run every 60 sec
> doesn't guarantee that it will run exactly when the minutes advance.
> So, if you are unlucky, your time shown in the echo area can be 59 sec
> late.

I'd expected that a first argument of t for run-at-time would take care
of that. From the Elisp doc:

  "-- Command: run-at-time time repeat function &rest args
      [...]
      In most cases, REPEAT has no effect on when _first_ call takes
      place--TIME alone specifies that.  There is one exception: if TIME
      is `t', then the timer runs whenever the time is a multiple of
     REPEAT seconds after the epoch.  This is useful for functions like
     `display-time'."

So if run-at-time does resync, calling (run-at-time t 60) should do the
job all by itself? For anxious people, just displaying the current time
rounded to the next full minute should be the equivalent of
belt-and-suspenders?

I mean, some moral equivalent of:

  (format-time-string "%H:%M"
     (seconds-to-time
       (* 60 (round (/ (float-time) 60)))))

Regards
- -- t
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAlU9CcQACgkQBcgs9XrR2kb0JgCfVTqCTWJmbZe7zj2VAwq8a5Op
hlkAn0NKfGyhYel+5/93fSeU0KWvnOau
=jVAB
-----END PGP SIGNATURE-----



reply via email to

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