diff --git a/calender.py b/calender.py index 13561e5..ba171bc 100644 --- a/calender.py +++ b/calender.py @@ -28,7 +28,7 @@ while (len(sys.argv) > 1): # Printing print(f" {year_hex}") -print("Prim Seco Tert Quad Quin Sext Sept Octo") +print("Prim Seco Tert Quat Quin Sena Sept Octo") day_of_week_start = start_day % 8 for x in range(day_of_week_start-1): @@ -50,5 +50,5 @@ for x in range(start_day, end_day): if (octal_counter % 8 == 0): print("") -print("\nPrim Seco Tert Quad Quin Sext Sept Octo") +print("\nPrim Seco Tert Quad Quin Sena Sept Octo") print(f" {year_hex}") diff --git a/time.sh b/time.sh old mode 100644 new mode 100755 index 31e5086..824fa76 --- a/time.sh +++ b/time.sh @@ -1,10 +1,17 @@ +if [ "$1" = "--help" ]; then + echo " + ' + \$span = span + \$day = day + \$year = year + time.sh + '%span %day/%year'" +fi #date month=$(date +"%m") dayofmonth=$(date +"%d") -year=$(date +"%Y") -if [ $((($year % 4))) == 0 ]; then +year_den=$(date +"%Y") +if [ $((($year_den % 4))) == 0 ]; then leapyear=1 -elif [ $((($year % 4))) > 0 ]; then +elif [ $((($year_den % 4))) > 0 ]; then leapyear=0 fi totalday=0 @@ -51,13 +58,23 @@ fi if (( $month > 11 )); then totalday=$((($totalday+30))); fi -totalday=$((($totalday+$dayofmonth))) +day_den=$(((10#$totalday+10#$dayofmonth))) +day_hex=$(printf "%x\n" $totalday) # Time second=$(date +"%S") minute=$(date +"%M") hour=$(date +"%H") nanosecond=$(date +"%N") second_of_the_day=$(bc -l <<< "($hour * 3600) + ($minute * 60) + $second") -span_of_the_day=$(bc -l <<< "$second_of_the_day * 0.864") -echo $span_of_the_day $totalday/$year +span_den=$(bc -l <<< "$second_of_the_day / (86400/65536)") +span_den=$(echo $span_den | awk '{printf("%d\n",$1 + 0.5)}' ) +span_hex=$(printf "%x\n" $span_den) +year_hex=$(printf "%x\n" $year_den) +if [ "$1" = "--den" ]; then + echo $span_den $day_den/$year_den +elif [ "$1" = "--hex" ]; then + echo $span_hex $day_hex/$year_hex +else + echo "specify hex or den with --hex or --den" +fi