The hextime
library provides functions for converting timestamps based on SI seconds to the more appropriate representation as 32 bit fractions-of-a-day, plus convenience functions for displaying them in hexadecimal time format.
#include <hextime.h>
uint32_t ts = 123456789; // some unix epoch timestamp
// by default this is now the fraction of day at the Florence Meridian
uint32_t timeOfDay = toHexTime(ts);
// use the Greenwich (UTC) Meridian instead
uint32_t timeOfDayAtGreenWich = toHexTime(ts, 0);
// get one hex digit
uint8_t hexHour = hexDigit(timeOfDay);
uint8_t hexMinute = hexDigit(timeOfDay, 1);
// get a whole 4 hex digit representation with leading period
// (don't forget to clean up the length 6 array after!)
char *hexString = printHexTime(timeOfDay, 4);
- The spiritual ancestor of all hexadecimal time representations is probably John W. Nystrom's Tonal system (1859/1863)
- In the early days of the internet, Mark V. Rogers and Pete Boardman proposed some new terminology and modifications to hexadecimal time representations
- Steffen Eitner maintains the wonderful (if woefully analog) Konsensuhr, alongside some other hexadecimal clocks with more fun digits.
- The official website of the International Bureau for hexadecimal metrology contains all information regarding the True Hexadecimal Prime Meridian (through Florence)
- the Futile Software Corporation also provides an online reference implementation and conversion tool for Florence Universal Hexadecimal Mean Time
- (Jack Hughes' The Colour Clock is a fun idea, but sadly the time conversion implementation seems off.)
This library is provided without warranty under some appropriate FOSS license.