Changeset 103
- Timestamp:
- 04/15/09 17:06:13 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libIGCM/libIGCM_date/libIGCM_date.ksh
r54 r103 23 23 #D-libIGCM_date 24 24 #D-This ksh library handles date calculs and convertions in different calendars. 25 #D- types of calendars are possible : 26 #D- 27 #D- - gregorian (other name leap) : 28 #D- The normal calendar. The time origin for the 29 #D- julian day in this case is 24 Nov -4713. 30 #D- - noleap : 31 #D- A 365 day year without leap years. 32 #D- - all_leap : 33 #D- A 366 day year with only leap years. 34 #D- - 360d : 35 #D- Year of 360 days with month of equal length. 25 36 26 37 # Number of digit in the year … … 158 169 159 170 # What is the calendar : 160 if [ "${config_UserChoices_CalendarType}" = "360d" ] ; then 161 if [ X$2 = X ] ; then 162 echo 360 163 else 164 eval $2=360 > /dev/null 2>&1 165 fi 171 case ${config_UserChoices_CalendarType} in 172 360d) 173 if [ X$2 = X ] ; then 174 echo 360 175 else 176 eval $2=360 > /dev/null 2>&1 177 fi 166 178 # IGCM_debug_PopStack "IGCM_date_DaysInYear" 167 return 168 else 169 if [ "${config_UserChoices_CalendarType}" = "noleap" ] ; then 179 return;; 180 noleap) 170 181 if [ X$2 = X ] ; then 171 182 echo 365 … … 175 186 176 187 # IGCM_debug_PopStack "IGCM_date_DaysInYear" 177 return 178 fi 179 fi 188 return;; 189 all_leap) 190 if [ X$2 = X ] ; then 191 echo 366 192 else 193 eval $2=366 > /dev/null 2>&1 194 fi 195 196 # IGCM_debug_PopStack "IGCM_date_DaysInYear" 197 return;; 198 esac 180 199 181 200 typeset y a … … 616 635 elif [ "${config_UserChoices_CalendarType}" = "noleap" ] ; then 617 636 res=$(( ( ( $yyyy1 - $yyyy2 ) * 365 ) + $res )) 637 elif [ "${config_UserChoices_CalendarType}" = "all_leap" ] ; then 638 res=$(( ( ( $yyyy1 - $yyyy2 ) * 366 ) + $res )) 618 639 elif ( [ "${config_UserChoices_CalendarType}" = "leap" ] || [ "${config_UserChoices_CalendarType}" = "gregorian" ] ) ; then 619 640 while [ $yyyy2 -lt $yyyy1 ] … … 724 745 noleap) 725 746 aux=-365;; 726 leap) 747 all_leap) 748 aux=-366;; 749 leap|gregorian) 727 750 aux=-366;; 728 751 esac … … 736 759 noleap) 737 760 aux=364635;; 738 leap) 761 all_leap) 762 aux=365634;; 763 leap|gregorian) 739 764 aux=364877;; 740 765 esac … … 748 773 noleap) 749 774 aux=693135;; 750 leap) 775 all_leap) 776 aux=695034;; 777 leap|gregorian) 751 778 aux=693595;; 752 779 esac
Note: See TracChangeset
for help on using the changeset viewer.