Tempus Fugit
published: 20 November 2020 / updated 20 November 2020
Romani horis
It was by programming the display on the SSD1306 128x32 OLED screen that I tested the display of icons on 2 lines. This is what the character display looks like X V I and L on this OLED screen:
Cet affichage correspond à 18:56 (06:56-PM).
Les romains ne connaissaient pas le chiffre 0. Alors comment peut-on afficher 13:00 ou 00:15?
Iaponica auxilium
To solve the problem of hours after midnight, for example 00:15, the Japanese (inhabitants of JAPAN) will be of great help to us.
If one day you go to this country, you will be amazed to see the shops open until 25:00!
This shop is open from 09:00 to 25:00! Oh yes. However, the clocks of JAPAN also do 24 hours. We knew the Japanese workers, but to the point of making 25 hour days, hummmm....
Actually, there is a very logical explanation. After 12:00, it is 12:01, etc ... And so, after 23:59, it is 24:00, then 24:01. So if a store closes at 25:00, you have to understand that it closes at 01:00 for us.
If we transpose this to our Roman clock, when it is 00:00, we can display XXIV (24:00).
Romanum minutes
We settled the case of zero hour by taking inspiration from the closing hours of some Jamponese shops.
How are we going to solve the case of hours like 01:00, 02:00... 23:00?
If we are logical, after 12:59, we can very well display 12:60, then the minute after 13:01... 12:60 in Roman numerals: XXII:LX
In hoc codice FORTH
For the basis of our program, we will simply define a word that accepts two values: hour and minute:
: nulla.obliterate ( nHH nMM --- nHH' nMM') dup 0= \ if nMM = 0 if drop 1- 60 then swap dup 0= \ if nHH = 0 if drop 24 then swap ;
We compile the code converting decimal digits into Roman digits, Decimal encoding to Roman numerals.
Then we compile this simple definition which uses two nested loops:
: clepsydra ( ---) 24 0 do 60 0 do j i nulla.obliterate swap roman type ." :" roman type cr key drop loop loop ;
Running clepsydra
displays this:
clepsydra XXIII:LX XXIV:I XXIV:II XXIV:III XXIV:IV XXIV:V XXIV:VI XXIV:VII XXIV:VIII XXIV:IX XXIV:X XXIV:XI XXIV:XII XXIV:XIII XXIV:XIV XXIV:XV XXIV:XVI XXIV:XVII XXIV:XVIII XXIV:XIX XXIV:XX XXIV:XXI XXIV:XXII XXIV:XXIII XXIV:XXIV
Le listing complet pour gForth est disponible ici:
clepsydra.txt