date '+scale=2;((%H*60+%M)*60+%S.%N)/8640' | bc
date '+scale=2;((%H*60+%M)*60+%S.%N)/8640' | bc
RE: https://velocipederider.com/@ruari/115475170910895200
@mherbert It was the shortest oneliner I have come up with so far to present the time in decimal for when I have to set my watch.
Though if I am truely honest I would usually just load
Or these days I also have a Garmin that can display in decimal time and that updates automatically, so I can just read it off that.
@ruari well ... I thought it would not make any difference, but it does:
$ date -Iseconds
2026-04-08T22:19:15+10:00
$ date '+scale=2;((%H*60+%M)*60+%S.%N)/8640' | bc
9.30
$ date '+scale=2;((%H*60+%M)*60)/8640' | bc
9.29
@mherbert Very often it will be fine but sometimes it will be off if you do not break down with more precision.
Of course you could argue, what is a decimal minute here or there but then, if you are gonna do this… might as well do it right, right!? 😆
@mherbert And of course I like the idea of being self sufficient.
If decimalnow.com dissappears one day or I break/lose/sell Garmin I will want to be able to be know what the right time is.
P.S. I could also make this really easy and just wait for an obvious exact time like midnight and midday. Then set the time to 00/10 or 5 respectively on the watch. 🤷