Chinese Zodiac Time for Emacs
Tags: emacs, unicode
Published: 2024-02-17 00:01:46

---
title: Chinese Zodiac Time for Emacs
published: true
date: 2024-02-13 03:22:33 UTC
tags: Emacs, Unicode
canonical_url: https://camdez.com/blog/2024/02/12/chinese-zodiac-time-for-emacs/
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7sf97bm75hqdnvg3nhdm.png
---

In the spirit of Chinese New Year, I hacked up a small extension for Emacs to render the current time of day using emoji and Chinese characters:

![Various screenshots of Emacs showing the time displayed with Chinese characters and emoji.](https://camdez.com/images/blog/chinese-zodiac-time-for-emacs/demo.jpg)
_Various configurations for your mode line._

It’s just a silly project that I’ll consider a success if it puts a smile on someone’s face, but it is loosely based on [a system used to measure time in the Ming dynasty](ming-system) which divided the day into 12 equal periods (時<sup id="fnref:1"><a href="#fn:1" role="doc-noteref">1</a></sup>), named after [the 12 earthly branches](https://en.wikipedia.org/wiki/Earthly_Branches) (地支).

Because the animals of the Chinese zodiac map 1-to-1 with the earthly branches, it is equally possible to indicate the time with the zodiac animals!

![Chart of correspondence between the earthly branches, zodiac animals, and times of day from Wikipedia. Apologies on this being in Spanish.](https://camdez.com/images/blog/chinese-zodiac-time-for-emacs/earthly-branches.jpg)
_Chart of correspondence between the earthly branches, zodiac animals, and times of day from Wikipedia. Apologies on this being in Spanish._

Given that a modern user probably wants to know which of our *24* hours they’re in, rather than which two hour period (時), I decided to differentiate the two halves as either 小 (small) or 大 (large).

Hence, in the image above showing the time as 「大🐲 四十二分」, the current time is 8:42am, by our modern reckoning (7:42am would be the *little* dragon!).

I won’t go into a ton of detail here because I explain it in some detail on [the project’s GitHub page](https://github.com/camdez/cn-zodiac-time.el).

The most amusing part of the project was, perhaps, deciding exactly which emoji to use! In the end, I implemented two sets of emoji you can choose from:

| Set | Emoji |
| --- | --- |
| `'cute` | 🐭🐮🐯🐰🐲🐍🐴🐏🐵🐔🐶🐷 |
| `'emoji` | 🐀🐄🐅🐇🐉🐍🐎🐑🐒🐓🐕🐖 |

_Rather disappointing that we don’t quite have a complete set of animal faces. At least not in Apple’s emoji._

If you’re wondering why I chose the COW (🐄) emoji in the second set rather than the OX (🐂), it’s because it looked too similar to the neighboring TIGER (🐅), making it easy to confuse the time.

If you don’t like my choices, the library also makes it extremely easy to bring your own set of emoji, so you can make your own decisions between:

- RAT (🐀), MOUSE (🐁), and MOUSE FACE (🐭)
- SHEEP (🐑), GOAT (🐐), and RAM (🐏)
- HORSE (🐎) and HORSE FACE (🐴)
- CHICKEN (🐔) and ROOSTER (🐓)
- Or maybe even pretend FROG (🐸) is a snake face
- Or spice up your horse with UNICORN (🦄)

_Clearly the sky’s the limit._

For Chinese learners or traditionalists, it can also display the time with:

- Traditional characters: 「大龍 四十二分」<sup id="fnref:2"><a href="#fn:2" role="doc-noteref">2</a></sup>
- Simplified characters: 「大龙 四十二分」
- Or earthly branches: 「辰正 四十二分」

(_n.b._ the earthly branches are displayed using the proper, traditional system of 初 and 正 suffixes, not my invented prefixes for animals.)

It’s a lot of fun telling time with cute animals, and might even help you learn a few things if you’re a beginner in Chinese, so [check it out on GitHub!](https://github.com/camdez/cn-zodiac-time.el)

龍年快樂！恭喜發財！ 🐉🧧

* * *

1. Students of the Chinese language may find it interesting to know that these _two_ hour periods are the reason we call (single) hours **小** 時 in modern Chinese (I know I did!). [↩︎](#fnref:1)

2. It’s not 100% clear to me if these characters will render the same regardless of locale, so I apologize if they do not appear as I have described—I’m still trying to get my head around [CJK unification](https://en.wikipedia.org/wiki/CJK_Unified_Ideographs) in Unicode. [↩︎](#fnref:2)