Changeset 2891 for trunk/MagicSoft/Mars/mbase/MAstro.cc
- Timestamp:
- 01/23/04 14:47:01 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mbase/MAstro.cc
r2604 r2891 216 216 Int_t MAstro::Ymd2Mjd(UShort_t y, Byte_t m, Byte_t d) 217 217 { 218 // Month lengths in days219 static int months[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };218 // Month lengths in days 219 static int months[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; 220 220 221 221 // Validate month … … 230 230 return -1; 231 231 232 // Lengthen year and month numbers to avoid overflow232 // Precalculate some values 233 233 const Byte_t lm = 12-m; 234 const ULong_t lm10 = 4712 + y +lm/10;234 const ULong_t lm10 = 4712 + y - lm/10; 235 235 236 236 // Perform the conversion 237 return 1461L*lm10/4 + (306*(( 21-lm)%12)+5)/10 - (3*((lm10+188)/100))/4 + d - 2399904;238 } 237 return 1461L*lm10/4 + (306*((m+9)%12)+5)/10 - (3*((lm10+188)/100))/4 + d - 2399904; 238 }
Note:
See TracChangeset
for help on using the changeset viewer.