I can have a large if/else
condition for each 30 minutes but I'm looking for more math and Unicode based solution.
Here are clock emojis: πππππππππππππππππ π‘π’π£π€π₯π¦π§. If you lack proper rendering support, you can see them below (they're not in the same order and they may look different to what you see) or at the Unicode chart, page 4. They correspond to Unicode codepoints U+1F550 (CLOCK FACE ONE OCLOCK) through U+1F567 (CLOCK FACE TWELVE-THIRTY).
Your challenge is to write a program that outputs to STDOUT the closest clock face emoji to the current system time (AM and PM should be treated the same). For example if the time t
is [5:15 β€ t < 5:45), you would display the 5:30 emoji π .
This is code-golf, so shortest code in bytes wins. You may want to include a way to easily specify the time to test your code.
Edge test cases
Time Output Written
----------------------
11:48 π 12:00
3:15 π 3:30
9:45 π 10:00