Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 2890)
+++ trunk/MagicSoft/Mars/Changelog	(revision 2891)
@@ -4,4 +4,11 @@
 
                                                  -*-*- END OF LINE -*-*-
+
+ 2004/01/23: Thomas Bretz
+
+   * mbase/MAstro.cc:
+     - Fixed calculation of MJD. In Ymd2Mjd a plus should be a minus.
+
+
 
  2004/01/23: Abelardo Moralejo
@@ -17,8 +24,12 @@
      - Added missing support for analysis of stereo files.
 
+
+
  2004/01/23: Raquel de los Reyes
 
    * macros/CCDataCheck.C
      - Added the temperature distribution of the optical links.
+
+
 
  2004/01/22: Abelardo Moralejo
@@ -46,4 +57,6 @@
        histogram used in the light calibration is written to the output
        file.
+
+
 
  2004/01/22: Thomas Bretz
Index: trunk/MagicSoft/Mars/mbase/MAstro.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MAstro.cc	(revision 2890)
+++ trunk/MagicSoft/Mars/mbase/MAstro.cc	(revision 2891)
@@ -216,6 +216,6 @@
 Int_t MAstro::Ymd2Mjd(UShort_t y, Byte_t m, Byte_t d)
 {
-   // Month lengths in days
-   static int months[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
+    // Month lengths in days
+    static int months[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
 
     // Validate month
@@ -230,9 +230,9 @@
         return -1;
 
-    // Lengthen year and month numbers to avoid overflow
+    // Precalculate some values
     const Byte_t  lm = 12-m;
-    const ULong_t lm10 = 4712 + y + lm/10;
+    const ULong_t lm10 = 4712 + y - lm/10;
 
     // Perform the conversion
-    return 1461L*lm10/4 + (306*((21-lm)%12)+5)/10 - (3*((lm10+188)/100))/4 + d - 2399904;
-}
+    return 1461L*lm10/4 + (306*((m+9)%12)+5)/10 - (3*((lm10+188)/100))/4 + d - 2399904;
+}
