Function: world-clock-display

world-clock-display is a byte-compiled function defined in time.el.gz.

Signature

(world-clock-display ALIST)

Documentation

Replace current buffer text with times in various zones, based on ALIST.

Probably introduced at or before Emacs version 28.1.

Aliases

display-time-world-display (obsolete since 28.1)

Source Code

;; Defined in /usr/src/emacs/lisp/time.el.gz
(defun world-clock-display (alist)
  "Replace current buffer text with times in various zones, based on ALIST."
  (let ((inhibit-read-only t)
	(buffer-undo-list t)
	(now (current-time))
	(max-width 0)
	result fmt)
    (erase-buffer)
    (dolist (zone alist)
      (let* ((label (cadr zone))
	     (width (string-width label)))
	(push (cons label
		    (format-time-string world-clock-time-format
					now (car zone)))
	      result)
	(when (> width max-width)
	  (setq max-width width))))
    (setq fmt (concat "%-" (int-to-string max-width) "s %s\n"))
    (dolist (timedata (nreverse result))
      (insert (format fmt
                      (propertize (car timedata)
                                  'face 'world-clock-label)
                      (cdr timedata))))
    (delete-char -1))
  (goto-char (point-min)))