Function: doom-modeline--generate-clock

doom-modeline--generate-clock is a natively compiled function defined in doom-modeline-segments.el.

Signature

(doom-modeline--generate-clock)

Documentation

Return a string containing the current time as an analogue clock svg.

When the svg library is not available, return nil.

Source Code

;; Defined in /nix/store/1lcicrdd2r4b8rkc91nnn74ymk1jl6yd-emacs-packages-deps/share/emacs/site-lisp/elpa/doom-modeline-20260928.1632/doom-modeline-segments.el
(defun doom-modeline--generate-clock ()
  "Return a string containing the current time as an analogue clock svg.
When the svg library is not available, return nil."
  (cdr
   (or (and (equal (truncate (float-time)
                             (* doom-modeline-time-clock-minute-resolution 60))
                   (car doom-modeline--clock-cache))
            doom-modeline--clock-cache)
       (and (require 'svg nil t)
            (setq doom-modeline--clock-cache
                  (cons (truncate (float-time)
                                  (* doom-modeline-time-clock-minute-resolution 60))
                        (propertize
                         " "
                         'display
                         (svg-image
                          (doom-modeline--create-clock-svg
                           (string-to-number (format-time-string "%-I")) ; hour
                           (* (truncate (string-to-number (format-time-string "%-M"))
                                        doom-modeline-time-clock-minute-resolution)
                              doom-modeline-time-clock-minute-resolution) ; minute
                           (if (integerp doom-modeline-time-clock-size) ; radius
                               doom-modeline-time-clock-size
                             (* doom-modeline-height 0.5 doom-modeline-time-clock-size))
                           "currentColor")
                          :scale 1 :ascent 'center)
                         'face 'doom-modeline-time
                         'help-echo (lambda (_window _object _pos)
                                      (format-time-string "%c")))))))))