(defpackage ๐ฐ๏ธ (:use :cl) (:import-from :local-time :timestamp-subtimezone :*default-timezone* :sec-of) (:export :โ)) (in-package :๐ฐ๏ธ) (declaim (optimize (safety 3))) (defparameter *clock-emojis* (vector #\๐ #\๐ง ; 00:00 - 00:30 #\๐ #\๐ ; 01:00 - 01:30 #\๐ #\๐ ; 00:00 - 00:30 #\๐ #\๐ ; 00:00 - 00:30 #\๐ #\๐ ; 00:00 - 00:30 #\๐ #\๐ ; 00:00 - 00:30 #\๐ #\๐ก ; 00:00 - 00:30 #\๐ #\๐ข ; 00:00 - 00:30 #\๐ #\๐ฃ ; 00:00 - 00:30 #\๐ #\๐ค ; 00:00 - 00:30 #\๐ #\๐ฅ ; 00:00 - 00:30 #\๐ #\๐ฆ)) ; 11:00 - 11:30 (defun โ (timestamp &optional (tz *default-timezone*)) "Convert a LOCAL-TIME:TIMESTAMP into the nearest Unicode clock face. Use TZ (which defaults to LOCAL-TIME:*DEFAULT-TIMEZONE*) to determine the UTC offset to factor when determining the local clock face." (let* ((offset (multiple-value-bind (offset-secs _dst _name) (timestamp-subtimezone timestamp tz) offset-secs)) (secs (+ (sec-of timestamp) offset))) (elt *clock-emojis* (mod (round (/ secs 1800)) 24))))