simplified julian date in finger
This commit is contained in:
parent
658ba7c295
commit
99a408c66a
|
@ -7,34 +7,10 @@ if [ "$3" = "latest" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$3" = "time" ]; then
|
if [ "$3" = "time" ]; then
|
||||||
GetJulianDay () {
|
|
||||||
year=$1
|
|
||||||
month=$2
|
|
||||||
day=$3
|
|
||||||
jd=$((day - 32075 + 1461 * (year + 4800 - (14 - month) / 12) / 4 + 367 * (month - 2 + ((14 - month) / 12) * 12) / 12 - 3 * ((year + 4900 - (14 - month) / 12) / 100) / 4))
|
|
||||||
printf "%s" "$jd"
|
|
||||||
}
|
|
||||||
|
|
||||||
GetJulianTime () {
|
|
||||||
mil="$(echo "x = ($(date +%s) - 43200 ) % 86400; scale=5; x / 86400" | bc)"
|
|
||||||
printf "%s" "$mil"
|
|
||||||
}
|
|
||||||
|
|
||||||
julian () {
|
|
||||||
year=$(date +"%Y")
|
|
||||||
month=$(date +"%m")
|
|
||||||
day=$(date +"%d")
|
|
||||||
|
|
||||||
todayJd=$(GetJulianDay "$year" "$month" "$day")
|
|
||||||
timeJd=$(GetJulianTime)
|
|
||||||
|
|
||||||
printf "%s%s\n" "$todayJd" "$timeJd"
|
|
||||||
}
|
|
||||||
|
|
||||||
echo The time is...
|
echo The time is...
|
||||||
d="$(date -u)"
|
d="$(date -u)"
|
||||||
beatTAI=$(echo "x = ($(date +%s)) % 86400; scale=3; x / 86.4" | bc)
|
beatTAI=$(echo "x = ($(date +%s)) % 86400; scale=3; x / 86.4" | bc)
|
||||||
j=$(julian)
|
j=$(echo "x = $(date +%s); scale=5; x / 86400 + 2440587.5" | bc)
|
||||||
printf "Gregorian Date : %s\n" "$d"
|
printf "Gregorian Date : %s\n" "$d"
|
||||||
printf "beatTAI : %s\n" "$beatTAI"
|
printf "beatTAI : %s\n" "$beatTAI"
|
||||||
printf "Julian Date : %s\n" "$j"
|
printf "Julian Date : %s\n" "$j"
|
||||||
|
|
Loading…
Reference in New Issue