Created
February 4, 2021 15:16
-
-
Save raresteak/5ade4a77cc52561fc1c57dee7ae0d8b5 to your computer and use it in GitHub Desktop.
Show remaining seconds, minutes, days, years to 32bit clock roll over on 19 January 2038 03:14:18 UTC
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
NOW=$(date -u -d "now" +%s) | |
EOW=$(date -u -d "19 January 2038 03:14:08 UTC" +%s ) | |
echo "Remaining time from Now: $(date -u) to " | |
echo " $(date -u -d "19 January 2038 03:14:18 UTC")" | |
echo "Remaining seconds: $(expr $EOW - $NOW)" | |
echo "Remaining minutes: $(echo "scale=2;$(expr $EOW - $NOW)/60" | bc)" | |
echo "Remaining hours : $(echo "scale=2;($(expr $EOW - $NOW)/60)/60" | bc)" | |
echo "Remaining days : $(echo "scale=2;(($(expr $EOW - $NOW)/60)/60)/24" | bc)" | |
echo "Remaining years : $(echo "scale=2;((($(expr $EOW - $NOW)/60)/60)/24)/365" | bc)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment