Index: /trunk/MagicSoft/Cosy/Changelog
===================================================================
--- /trunk/MagicSoft/Cosy/Changelog	(revision 2614)
+++ /trunk/MagicSoft/Cosy/Changelog	(revision 2615)
@@ -26,4 +26,37 @@
    * Makefile:
      - added 'install'
+
+   * bending_magic.txt:
+     - small chenges to correct AN, AW correction (new fit)
+     
+   * cosy.cc, candrv/nodedrv.cc, devdrv/macs.[h,cc],
+     devdrv/shaftencoder.[h,cc], gui/MGCosy.cc,
+     gui/MGPngReader.cc, gui/MGTPoint.cc, main/MBending.cc,
+     main/MCaos.cc, main/MCosy.cc, main/MStarguider.[h,cc],
+     tcpip/MCeCoCom.[h,cc], tcpip/MDriveCom.cc,
+     videodev/Writer.cc:
+     - replaced Timer by MTime
+     
+   * base/BaseLinkDef.h:
+     - added MTime
+     - added MAstro
+     
+   * base/Makefile:
+     - added MTime
+     - added MAstro
+     
+   * catalog/SlaStars.[h,cc], catalog/Slalib.[h,cc]:
+     - made independant of derivement from Timer
+     - added old Timer as new MTime fTime data member
+
+   * catalog/Slalib.h:
+     - removed conversion functions - use MAstro instead
+
+   * gui/MGCosy.cc, gui/MGSkyPosition.cc, tcpip/MDriveCom.cc:
+     - replaced static Slalib:: methody by MAstro
+     
+   * main/MBending.[h,cc]:
+     - added corrected An/Aw algorithm
+     - removed 360deg ambiguity
 
 
Index: /trunk/MagicSoft/Cosy/Makefile
===================================================================
--- /trunk/MagicSoft/Cosy/Makefile	(revision 2614)
+++ /trunk/MagicSoft/Cosy/Makefile	(revision 2615)
@@ -131,6 +131,10 @@
 	@ln -sf ../../Mars/mbase/MLogManip.h base/MLogManip.h
 	@ln -sf ../../Mars/mbase/MLogManip.cc base/MLogManip.cc
+	@ln -sf ../../Mars/mbase/MAstro.h base/MAstro.h
+	@ln -sf ../../Mars/mbase/MAstro.cc base/MAstro.cc
 	@ln -sf ../../Mars/mbase/MGList.h base/MGList.h
 	@ln -sf ../../Mars/mbase/MGList.cc base/MGList.cc
+	@ln -sf ../../Mars/mbase/MTime.h base/MTime.h
+	@ln -sf ../../Mars/mbase/MTime.cc base/MTime.cc
 	@ln -sf ../../Mars/mbase/MParContainer.h base/MParContainer.h
 	@ln -sf ../../Mars/mbase/MParContainer.cc base/MParContainer.cc
Index: /trunk/MagicSoft/Cosy/base/BaseLinkDef.h
===================================================================
--- /trunk/MagicSoft/Cosy/base/BaseLinkDef.h	(revision 2614)
+++ /trunk/MagicSoft/Cosy/base/BaseLinkDef.h	(revision 2615)
@@ -11,4 +11,8 @@
 #pragma link C++ class MParContainer+;
 #pragma link C++ class MObservatory+;
+#pragma link C++ class MAstro+;
+
+#pragma link C++ class MTime+;
+#pragma link C++ function operator<<(ostream&, MTime&);
 
 #endif
Index: /trunk/MagicSoft/Cosy/base/Makefile
===================================================================
--- /trunk/MagicSoft/Cosy/base/Makefile	(revision 2614)
+++ /trunk/MagicSoft/Cosy/base/Makefile	(revision 2615)
@@ -36,4 +36,6 @@
            MThread.cc \
 	   MTimeout.cc \
+           MTime.cc \
+           MAstro.cc \
 	   MStar.cc \
 	   MStarList.cc \
@@ -42,9 +44,10 @@
            MLogManip.cc \
            MObservatory.cc \
-           MGList.cc \
-           timer.cc 
+           MGList.cc
 
 CINTHEADERS = MStar.h \
 	      MGList.h \
+              MTime.h \
+              MAstro.h \
 	      MLog.h \
 	      MLogManip.h \
Index: /trunk/MagicSoft/Cosy/bending_magic.txt
===================================================================
--- /trunk/MagicSoft/Cosy/bending_magic.txt	(revision 2614)
+++ /trunk/MagicSoft/Cosy/bending_magic.txt	(revision 2615)
@@ -1,10 +1,10 @@
-MAGIC1 2003/11/23 0:46:12.880585
+MAGIC1 2003/12/07 0:02:39.100594
 S   00   000000   000000  0000000
-     IA      501.6639   0.034618314
-     IE    -9.0592286   0.020049537
+     IA     501.66388   0.034611014
+     IE    -9.0592376    0.02005678
    FLOP             0             0
      AN             0             0
-     AW    -1.5593339   0.022280707
-   NPAE   0.073756927   0.039384952
+     AW    -1.5593388   0.022279916
+   NPAE   0.073726654   0.039384899
      CA             0             0
      TF             0             0
Index: /trunk/MagicSoft/Cosy/candrv/nodedrv.cc
===================================================================
--- /trunk/MagicSoft/Cosy/candrv/nodedrv.cc	(revision 2614)
+++ /trunk/MagicSoft/Cosy/candrv/nodedrv.cc	(revision 2615)
@@ -50,5 +50,5 @@
 #include <TTimer.h>
 
-#include "base/timer.h"
+#include "MTime.h"
 #include "network.h"
 #include "MLogManip.h"
@@ -489,6 +489,6 @@
 class NodeGuard : public MThread
 {
-    Double_t fTimeoutTime;
-    Double_t fGuardTime;
+    Double_t fTimeoutTime;     //[s]
+    Double_t fGuardTime;       //[s]
     Int_t    fLifeTimeFactor;
 
@@ -503,7 +503,7 @@
     void Reset(timeval_t *tv=NULL)
     {
-        Timer t;
+        MTime t;
         if (tv)
-            t.SetTimer(tv);
+            t.Set(*tv);
         else
             t.Now();
@@ -525,8 +525,8 @@
                 fDrv->SendNodeguard();
 
-            Timer t;
+            MTime t;
             t.Now();
 
-            const Timer t0 = t+fGuardTime;
+            const Double_t t0 = t+fGuardTime;
 
             while (!HasStopFlag() && t<t0 && t<fTimeoutTime)
Index: /trunk/MagicSoft/Cosy/catalog/SlaStars.cc
===================================================================
--- /trunk/MagicSoft/Cosy/catalog/SlaStars.cc	(revision 2614)
+++ /trunk/MagicSoft/Cosy/catalog/SlaStars.cc	(revision 2615)
@@ -31,5 +31,5 @@
 }
 
-void SlaStars::SetMjd(const double mjd)
+void SlaStars::SetMjd(double mjd)
 {
     Slalib::SetMjd(mjd);
Index: /trunk/MagicSoft/Cosy/catalog/SlaStars.h
===================================================================
--- /trunk/MagicSoft/Cosy/catalog/SlaStars.h	(revision 2614)
+++ /trunk/MagicSoft/Cosy/catalog/SlaStars.h	(revision 2615)
@@ -23,5 +23,5 @@
     //    const RaDec GetRaDec() const { return fRaDec*360/D2PI; }
 
-    virtual void SetMjd(const double mjd);
+    virtual void SetMjd(double mjd);
 
     void   Set(const AltAz &altaz);
Index: /trunk/MagicSoft/Cosy/catalog/Slalib.cc
===================================================================
--- /trunk/MagicSoft/Cosy/catalog/Slalib.cc	(revision 2614)
+++ /trunk/MagicSoft/Cosy/catalog/Slalib.cc	(revision 2615)
@@ -10,9 +10,5 @@
 ClassImp(Slalib);
 
-Slalib::Slalib(MObservatory::LocationName_t key) : Timer(), MObservatory(key)
-{
-}
-
-Slalib::~Slalib()
+Slalib::Slalib(MObservatory::LocationName_t key) : MObservatory(key)
 {
 }
@@ -32,5 +28,5 @@
 void Slalib::SetMjd(double mjd)
 {
-    Timer::SetMjd(mjd);
+    fTime.SetMjd(mjd);
     fAlpha = slaGmst(mjd) + GetElong();
 }
@@ -57,5 +53,5 @@
     return ZdAz(kPiDiv2-alt, az);
 }
-
+/*
 Double_t Slalib::Hms2Sec(Int_t deg, UInt_t min, Double_t sec, Char_t sgn)
 {
@@ -66,5 +62,5 @@
 Double_t Slalib::Dms2Rad(Int_t deg, UInt_t min, Double_t sec, Char_t sgn)
 {
-    /* pi/(180*3600):  arcseconds to radians */
+    // pi/(180*3600):  arcseconds to radians
 #define DAS2R 4.8481368110953599358991410235794797595635330237270e-6
     return Hms2Sec(deg, min, sec, sgn)*DAS2R;
@@ -73,5 +69,5 @@
 Double_t Slalib::Hms2Rad(Int_t hor, UInt_t min, Double_t sec, Char_t sgn)
 {
-    /* pi/(12*3600):  seconds of time to radians */
+    // pi/(12*3600):  seconds of time to radians
 #define DS2R 7.2722052166430399038487115353692196393452995355905e-5
     return Hms2Sec(hor, min, sec, sgn)*DS2R;
@@ -100,11 +96,11 @@
 void Slalib::Day2Hms(Double_t day, Char_t &sgn, UShort_t &hor, UShort_t &min, UShort_t &sec)
 {
-    /* Handle sign */
+    // Handle sign
     sgn = day<0?'-':'+';
 
-    /* Round interval and express in smallest units required */
+    // Round interval and express in smallest units required
     Double_t a = Round(86400. * TMath::Abs(day)); // Days to seconds
 
-    /* Separate into fields */
+    // Separate into fields
     const Double_t ah = Trunc(a/3600.);
     a -= ah * 3600.;
@@ -113,5 +109,5 @@
     const Double_t as = Trunc(a);
 
-    /* Return results */
+    // Return results
     hor = (UShort_t)ah;
     min = (UShort_t)am;
@@ -151,15 +147,15 @@
 void Slalib::Day2Hm(Double_t day, Char_t &sgn, UShort_t &hor, Double_t &min)
 {
-    /* Handle sign */
+    // Handle sign
     sgn = day<0?'-':'+';
 
-    /* Round interval and express in smallest units required */
+    // Round interval and express in smallest units required
     Double_t a = Round(86400. * TMath::Abs(day)); // Days to seconds
 
-    /* Separate into fields */
+    // Separate into fields
     const Double_t ah = Trunc(a/3600.);
     a -= ah * 3600.;
 
-    /* Return results */
+    // Return results
     hor = (UShort_t)ah;
     min = a/60.;
@@ -196,2 +192,3 @@
 }
 
+*/
Index: /trunk/MagicSoft/Cosy/catalog/Slalib.h
===================================================================
--- /trunk/MagicSoft/Cosy/catalog/Slalib.h	(revision 2614)
+++ /trunk/MagicSoft/Cosy/catalog/Slalib.h	(revision 2615)
@@ -5,10 +5,12 @@
 
 #include "coord.h"
-#include "timer.h"
+#include "MTime.h"
 #include "MObservatory.h"
 
-class Slalib : public Timer, public MObservatory
+class Slalib : public MObservatory
 {
 private:
+    MTime fTime;
+
     double fAlpha;
 
@@ -18,31 +20,9 @@
 public:
     Slalib(MObservatory::LocationName_t key);
-    virtual ~Slalib();
-
-    static Double_t Hms2Sec(Int_t deg, UInt_t min, Double_t sec, char sgn='+');
-    static Double_t Dms2Rad(Int_t deg, UInt_t min, Double_t sec, Char_t sgn='+');
-    static Double_t Hms2Rad(Int_t hor, UInt_t min, Double_t sec, Char_t sgn='+');
-    static Double_t Dms2Deg(Int_t deg, UInt_t min, Double_t sec, Char_t sgn='+');
-    static Double_t Hms2Deg(Int_t hor, UInt_t min, Double_t sec, Char_t sgn='+');
-    static Double_t Dms2Hor(Int_t deg, UInt_t min, Double_t sec, Char_t sgn='+');
-    static Double_t Hms2Hor(Int_t hor, UInt_t min, Double_t sec, Char_t sgn='+');
-
-    static void Day2Hms(Double_t rad, Char_t &sgn, UShort_t &deg, UShort_t &min, UShort_t &sec);
-    static void Rad2Dms(Double_t rad, Char_t &sgn, UShort_t &deg, UShort_t &min, UShort_t &sec);
-    static void Rad2Hms(Double_t rad, Char_t &sgn, UShort_t &deg, UShort_t &min, UShort_t &sec);
-    static void Deg2Dms(Double_t rad, Char_t &sgn, UShort_t &deg, UShort_t &min, UShort_t &sec);
-    static void Deg2Hms(Double_t rad, Char_t &sgn, UShort_t &deg, UShort_t &min, UShort_t &sec);
-    static void Hor2Dms(Double_t rad, Char_t &sgn, UShort_t &deg, UShort_t &min, UShort_t &sec);
-    static void Hor2Hms(Double_t rad, Char_t &sgn, UShort_t &deg, UShort_t &min, UShort_t &sec);
-
-    static void Day2Hm(Double_t rad, Char_t &sgn, UShort_t &deg, Double_t &min);
-    static void Rad2Dm(Double_t rad, Char_t &sgn, UShort_t &deg, Double_t &min);
-    static void Rad2Hm(Double_t rad, Char_t &sgn, UShort_t &deg, Double_t &min);
-    static void Deg2Dm(Double_t rad, Char_t &sgn, UShort_t &deg, Double_t &min);
-    static void Deg2Hm(Double_t rad, Char_t &sgn, UShort_t &deg, Double_t &min);
-    static void Hor2Dm(Double_t rad, Char_t &sgn, UShort_t &deg, Double_t &min);
-    static void Hor2Hm(Double_t rad, Char_t &sgn, UShort_t &deg, Double_t &min);
 
     virtual void SetMjd(double mjd);
+    Double_t GetMjd() const { return fTime.GetMjd(); }
+    void Now() { fTime.Now(); }
+    const MTime &GetTime() const { return fTime; }
 
     double GetAlpha() const  { return fAlpha; }
Index: /trunk/MagicSoft/Cosy/cosy.cc
===================================================================
--- /trunk/MagicSoft/Cosy/cosy.cc	(revision 2614)
+++ /trunk/MagicSoft/Cosy/cosy.cc	(revision 2615)
@@ -7,6 +7,6 @@
 
 #include "MCosy.h"
+#include "MTime.h"
 #include "MLogManip.h"
-#include "base/timer.h"
 
 #include "Camera.h"
@@ -36,15 +36,14 @@
     gLog << endl;
 
-    Timer time;
-    time.Now();
-
     //
-    // this must move to MGCosy !!!! (or MApplication)
+    // this must move to MGCosy !!!!
     //
-    int i=0;
-    char name[100];
+    MTime time;
+    TString name;
     while (1)
     {
-        sprintf(name, "log/cosy%03d.log", i++);
+        time.Now();
+        name = Form("log/cosy_%s.log", (const char*)time.GetFileName());
+        cout << "Test: " << time.GetFileName() << " " << name << endl;
         if (gSystem->AccessPathName(name, kFileExists))
             break;
@@ -70,5 +69,5 @@
     //
     clog("- Constructing MCosy.");
-
+/*
     //
     // check for the right usage of the program
@@ -88,6 +87,6 @@
             break;
         }
-
-    MCosy *cosy = new MCosy(mode, "/dev/dpm_00", 125, lout);
+*/
+    MCosy *cosy = new MCosy("/dev/dpm_00", 125, lout);
 
     clog("- Starting MCosy.");
@@ -134,4 +133,3 @@
 
     cout << "The End." << endl;
-
 }
Index: /trunk/MagicSoft/Cosy/devdrv/macs.cc
===================================================================
--- /trunk/MagicSoft/Cosy/devdrv/macs.cc	(revision 2614)
+++ /trunk/MagicSoft/Cosy/devdrv/macs.cc	(revision 2615)
@@ -4,5 +4,4 @@
 #include <sys/time.h>   // timeval->tv_sec
 
-#include "timer.h"
 #include "network.h"
 #include "MLogManip.h"
@@ -32,6 +31,6 @@
 Macs::Macs(const BYTE_t nodeid, const char *name, MLog &out)
     : NodeDrv(nodeid, name, out), fMacId(2*nodeid+1),
-    fPos(0), fPosTime(0.0), fPdoPos(0), fPdoTime(0.0),
-    fPosActive(0), fRpmActive(0), fStatusPdo3(0xff)
+    fPos(0), fPdoPos(0), fPosActive(0), fRpmActive(0),
+    fStatusPdo3(0xff)
 {
 //    fTimeout = new TTimer(this, 100); //, kFALSE); // 100ms, asynchronous
@@ -87,5 +86,5 @@
 //        lout << "Actual Position: " << dec << (signed long)val << endl;
         fPos = (LWORDS_t)val;
-        fPosTime.SetTimer(tv);
+        fPosTime.Set(*tv);
         return;
 /*
@@ -576,5 +575,5 @@
     fStatus = data[3];
 
-    fPdoTime.SetTimer(tv);
+    fPdoTime.Set(*tv);
 }
 
@@ -735,5 +734,5 @@
         return;
 
-    Timer time;
+    MTime time;
     time.Now();
 
@@ -811,24 +810,4 @@
 }
 
-double Macs::GetTime()
-{
-    return fPosTime.Now();
-}
-
-double Macs::GetMjd()
-{
-    return fPosTime.GetMjd();
-}
-
-double Macs::GetPdoTime()
-{
-    return fPdoTime.Now();
-}
-
-double Macs::GetPdoMjd()
-{
-    return fPdoTime.GetMjd();
-}
-
 /*   0x2000 0 rw Maximum positioning error     */
 /*          1 rw Negative Software Endswitch   */
Index: /trunk/MagicSoft/Cosy/devdrv/macs.h
===================================================================
--- /trunk/MagicSoft/Cosy/devdrv/macs.h	(revision 2614)
+++ /trunk/MagicSoft/Cosy/devdrv/macs.h	(revision 2615)
@@ -3,5 +3,5 @@
 
 #include "nodedrv.h"
-#include "base/timer.h"
+#include "MTime.h"
 
 class Macs : public NodeDrv
@@ -16,10 +16,10 @@
 
     LWORDS_t fPos;
-    Timer    fPosTime;
+    MTime    fPosTime;
 
     LWORD_t  fRes;      // Encoder resolution
 
     LWORDS_t fPdoPos;
-    Timer    fPdoTime;
+    MTime    fPdoTime;
 
     BYTE_t   fPosActive;
@@ -106,10 +106,4 @@
     BYTE_t GetStatus() const { return fStatus; }
 
-    double GetTime();
-    double GetMjd();
-
-    double GetPdoTime();
-    double GetPdoMjd();
-
     LWORDS_t GetPdoPos() const { return fPdoPos; }
 
Index: /trunk/MagicSoft/Cosy/devdrv/shaftencoder.cc
===================================================================
--- /trunk/MagicSoft/Cosy/devdrv/shaftencoder.cc	(revision 2614)
+++ /trunk/MagicSoft/Cosy/devdrv/shaftencoder.cc	(revision 2615)
@@ -1,5 +1,4 @@
 #include "shaftencoder.h"
 
-#include "base/timer.h"
 #include "network.h"
 
@@ -182,5 +181,5 @@
 
     fPos = pos;
-    fTime.SetTimer(tv);
+    fTime.Set(*tv);
     fPosHasChanged = true;
 }
@@ -198,5 +197,5 @@
 
     fPos=pos;
-    fTime.SetTimer(tv);
+    fTime.Set(*tv);
     fPosHasChanged=true;
 
@@ -234,11 +233,6 @@
     fTurn = turn;
 
-    fTime.SetTimer(tv);
+    fTime.Set(*tv);
     fPosHasChanged=true;
-}
-
-double ShaftEncoder::GetTime()
-{
-    return fTime.Now();
 }
 
Index: /trunk/MagicSoft/Cosy/devdrv/shaftencoder.h
===================================================================
--- /trunk/MagicSoft/Cosy/devdrv/shaftencoder.h	(revision 2614)
+++ /trunk/MagicSoft/Cosy/devdrv/shaftencoder.h	(revision 2615)
@@ -2,6 +2,6 @@
 #define SHAFTENCODER_H
 
-#include "base/timer.h"
 #include "nodedrv.h"
+#include "MTime.h"
 
 class TGLabel;
@@ -24,5 +24,5 @@
     bool fPosHasChanged;  //!
 
-    Timer fTime;
+    MTime fTime;
 
     void HandlePDOType0(BYTE_t *data, timeval_t *tv);
@@ -54,5 +54,4 @@
     LWORD_t  GetPhysRes() { return fTicks; }
 
-    double GetTime();
     double GetMjd();
 
Index: /trunk/MagicSoft/Cosy/gui/MGCosy.cc
===================================================================
--- /trunk/MagicSoft/Cosy/gui/MGCosy.cc	(revision 2614)
+++ /trunk/MagicSoft/Cosy/gui/MGCosy.cc	(revision 2615)
@@ -22,7 +22,7 @@
 #include <TApplication.h>  // gApplication
 
-//#include "timer.h"         // Timer
-
 #include "MCosy.h"
+#include "MTime.h"
+#include "MAstro.h"
 #include "MGList.h"
 #include "MDriveCom.h"
@@ -365,5 +365,5 @@
         box->AddEntry(str, i++);
 
-        fStarList.Add(Slalib::Hms2Hor(h, m, s), Slalib::Dms2Deg(d, am, as));
+        fStarList.Add(MAstro::Hms2Hor(h, m, s), MAstro::Dms2Deg(d, am, as));
     }
 }
@@ -889,6 +889,6 @@
 
     // Calculate Display values
-    Slalib::Rad2Hm(rd.Ra(),  sh, h, hm);
-    Slalib::Rad2Dm(rd.Dec(), sd, d, dm);
+    MAstro::Rad2Hm(rd.Ra(),  sh, h, hm);
+    MAstro::Rad2Dm(rd.Dec(), sd, d, dm);
 
     rd.Ra(rd.Ra()  * 12/TMath::Pi());
@@ -922,6 +922,6 @@
 
     // Calculate display values
-    Slalib::Hor2Hm(radec.Ra(),  sh, h, hm);
-    Slalib::Deg2Dm(radec.Dec(), sd, d, dm);
+    MAstro::Hor2Hm(radec.Ra(),  sh, h, hm);
+    MAstro::Deg2Dm(radec.Dec(), sd, d, dm);
 
     test = radec*600;
@@ -974,6 +974,6 @@
     Char_t   sz, sa;
 
-    Slalib::Rad2Dm(soll.Zd(), sz, z, zm);
-    Slalib::Rad2Dm(soll.Az(), sa, a, am);
+    MAstro::Rad2Dm(soll.Zd(), sz, z, zm);
+    MAstro::Rad2Dm(soll.Az(), sa, a, am);
 
     const ZdAz test = soll*kRad2Deg*600;
@@ -994,33 +994,25 @@
 double MGCosy::UpdateTime()
 {
-    Timer time;
+    MTime time;
     time.Now();
 
-    static char oldtxt[256];
-
-    char text[256];
-
-    strcpy(text, time.GetTimeStr());
-
-    char *dot = strrchr(text, '.');
-
-    if (dot)
-        dot[2] = 0;
-
-    if (strcmp(oldtxt, text))
+    static TString oldtxt;
+
+    TString text(time.GetString());
+    text.Remove(text.Last('.')+2);
+
+    if (text!=oldtxt)
     {
         fUtc->SetText(new TGString(text));
-        strcpy(oldtxt, text);
-    }
-
-    static long oldmjd;
-    double mjd = time.GetMjd();
-
-    if (oldmjd != 1000000*mjd)
-    {
-        sprintf(text, "%12.6f", mjd);
-        fMjd->SetText(new TGString(text));
-
-        oldmjd = (long)(1000000*mjd);
+        oldtxt = text;
+    }
+
+    static ULong_t oldmjd=0;
+    const double mjd = time.GetMjd();
+
+    if (oldmjd != (ULong_t)(1000000*mjd))
+    {
+        fMjd->SetText(new TGString(Form("%12.6f", mjd)));
+        oldmjd = (ULong_t)(1000000*mjd);
     }
 
@@ -1034,5 +1026,5 @@
     acc *= kRad2Deg;   // [deg]
 
-    double mjd = UpdateTime();
+    const double mjd = UpdateTime();
     fSkyPosition->Update(pos, mjd);
     //UpdateOffset(off);
@@ -1205,6 +1197,6 @@
         while (i-->0)
         {
-            Timer tm;
-            tm.Now();
+            //Timer tm;
+            //tm.Now();
 
             if (!Move(75, -80, 1000000, 13))
@@ -1386,8 +1378,8 @@
                     UShort_t d, m, s;
                     Char_t sgn;
-                    Slalib::Deg2Dms(za.X(), sgn, d, m, s);
+                    MAstro::Deg2Dms(za.X(), sgn, d, m, s);
                     if (sgn=='-') fout << sgn;
                     fout << d << " " << m << " " << s << " \t";
-                    Slalib::Deg2Dms(za.Y(), sgn, d, m, s);
+                    MAstro::Deg2Dms(za.Y(), sgn, d, m, s);
                     if (sgn=='-') fout << sgn;
                     fout << d << " " << m << " " << s << " \t";
Index: /trunk/MagicSoft/Cosy/gui/MGPngReader.cc
===================================================================
--- /trunk/MagicSoft/Cosy/gui/MGPngReader.cc	(revision 2614)
+++ /trunk/MagicSoft/Cosy/gui/MGPngReader.cc	(revision 2615)
@@ -25,5 +25,5 @@
 #include "CaosFilter.h"
 #include "Writer.h"
-#include "base/timer.h"
+#include "MTime.h"
 
 #include "MStarList.h"
@@ -1022,8 +1022,8 @@
         // Double_t kConv = 0.502; // [pix/mm]
 
-        static Timer t0(tm);
-        Timer t(tm);
-
-        fTime = (t.GetMjd()-t0.GetMjd())*24*60*60;
+        static MTime t0(*tm);
+        MTime t(*tm);
+
+        fTime = t-t0;
 
         Leds leds;
@@ -1098,5 +1098,5 @@
     if (fDisplay->IsEntryChecked(IDM_kCatalog))
     {
-        Timer time(tm);
+        MTime time(*tm);
 
         GetCoordinates();
Index: /trunk/MagicSoft/Cosy/gui/MGSkyPosition.cc
===================================================================
--- /trunk/MagicSoft/Cosy/gui/MGSkyPosition.cc	(revision 2614)
+++ /trunk/MagicSoft/Cosy/gui/MGSkyPosition.cc	(revision 2615)
@@ -16,4 +16,5 @@
 
 #include "coord.h"
+#include "MAstro.h"
 #include "SlaStars.h"
 #include "SlaPlanets.h"
@@ -113,25 +114,25 @@
 {
     // 32349   Sirius           -1.44 1.45    2.64      0.009   A0m
-    (RaDec(Slalib::Hms2Rad(  6, 45,  0), Slalib::Dms2Rad(-16, 42,  0))),
+    (RaDec(MAstro::Hms2Rad(  6, 45,  0), MAstro::Dms2Rad(-16, 42,  0))),
     // 30438   Canopus          -0.62 -5.53   95.88     0.164   F0Ib
-    (RaDec(Slalib::Hms2Rad(  6, 23,  0), Slalib::Dms2Rad(-52, 41,  0))),
+    (RaDec(MAstro::Hms2Rad(  6, 23,  0), MAstro::Dms2Rad(-52, 41,  0))),
     // 69673   Arcturus         -0.05 -0.31   11.25     1.239   K2IIIp
-    (RaDec(Slalib::Hms2Rad( 14, 15,  0), Slalib::Dms2Rad( 19, 10,  0))),
+    (RaDec(MAstro::Hms2Rad( 14, 15,  0), MAstro::Dms2Rad( 19, 10,  0))),
     //         Vega              0.03
-    (RaDec(Slalib::Hms2Rad( 18, 37,  0), Slalib::Dms2Rad( 38, 47,  0))),
+    (RaDec(MAstro::Hms2Rad( 18, 37,  0), MAstro::Dms2Rad( 38, 47,  0))),
     //         Altair            0.77
-    (RaDec(Slalib::Hms2Rad( 19, 50,  0), Slalib::Dms2Rad(  8, 52,  6))),
+    (RaDec(MAstro::Hms2Rad( 19, 50,  0), MAstro::Dms2Rad(  8, 52,  6))),
     //         Antares           0.96
-    (RaDec(Slalib::Hms2Rad( 16, 29, 25), Slalib::Dms2Rad(-26, 25, 55))),
+    (RaDec(MAstro::Hms2Rad( 16, 29, 25), MAstro::Dms2Rad(-26, 25, 55))),
     //         Spica             0.98
-    (RaDec(Slalib::Hms2Rad( 13, 25, 13), Slalib::Dms2Rad(-11,  9, 41))),
+    (RaDec(MAstro::Hms2Rad( 13, 25, 13), MAstro::Dms2Rad(-11,  9, 41))),
     //         Deneb             1.25
-    (RaDec(Slalib::Hms2Rad( 20, 41, 26), Slalib::Dms2Rad( 45, 16, 49))),
-    (RaDec(Slalib::Hms2Rad(  1, 37,  6), Slalib::Dms2Rad(-57, 14,  0))),
-    (RaDec(Slalib::Hms2Rad( 12, 26,  6), Slalib::Dms2Rad(-63, 06,  0))),
-    (RaDec(Slalib::Hms2Rad(  5, 14,  0), Slalib::Dms2Rad(- 8, 12,  5))),
-    (RaDec(Slalib::Hms2Rad(  5, 16,  0), Slalib::Dms2Rad( 46, 00,  0))),
-    (RaDec(Slalib::Hms2Rad(  7, 39,  0), Slalib::Dms2Rad(  5, 14,  0))),
-    (RaDec(Slalib::Hms2Rad(  5, 55,  0), Slalib::Dms2Rad(  7, 24,  0)))
+    (RaDec(MAstro::Hms2Rad( 20, 41, 26), MAstro::Dms2Rad( 45, 16, 49))),
+    (RaDec(MAstro::Hms2Rad(  1, 37,  6), MAstro::Dms2Rad(-57, 14,  0))),
+    (RaDec(MAstro::Hms2Rad( 12, 26,  6), MAstro::Dms2Rad(-63, 06,  0))),
+    (RaDec(MAstro::Hms2Rad(  5, 14,  0), MAstro::Dms2Rad(- 8, 12,  5))),
+    (RaDec(MAstro::Hms2Rad(  5, 16,  0), MAstro::Dms2Rad( 46, 00,  0))),
+    (RaDec(MAstro::Hms2Rad(  7, 39,  0), MAstro::Dms2Rad(  5, 14,  0))),
+    (RaDec(MAstro::Hms2Rad(  5, 55,  0), MAstro::Dms2Rad(  7, 24,  0)))
 };
 
@@ -334,6 +335,6 @@
     Char_t   sx, sy;
     Double_t xm, ym;
-    Slalib::Deg2Dm(x, sx, xd, xm);
-    Slalib::Deg2Dm(y, sy, yd, ym);
+    MAstro::Deg2Dm(x, sx, xd, xm);
+    MAstro::Deg2Dm(y, sy, yd, ym);
 
     const int fx = (int)(x*600);
Index: /trunk/MagicSoft/Cosy/gui/MGTPoint.cc
===================================================================
--- /trunk/MagicSoft/Cosy/gui/MGTPoint.cc	(revision 2614)
+++ /trunk/MagicSoft/Cosy/gui/MGTPoint.cc	(revision 2615)
@@ -18,5 +18,5 @@
 #include "Filter.h"
 #include "Writer.h"
-#include "base/timer.h"
+#include "MTime.h"
 
 ClassImp(MGStarguider);
@@ -397,5 +397,5 @@
             GetCoordinates();
 
-            Timer time(tm);
+            MTime time(*tm);
             fSao->GetImg(myimg, cimg, time.CalcMjd(), *fRaDec);
             fImage->DrawColImg(myimg, cimg);
Index: /trunk/MagicSoft/Cosy/main/MBending.cc
===================================================================
--- /trunk/MagicSoft/Cosy/main/MBending.cc	(revision 2614)
+++ /trunk/MagicSoft/Cosy/main/MBending.cc	(revision 2615)
@@ -65,5 +65,5 @@
 #include <TMinuit.h>
 
-#include "timer.h"
+#include "MTime.h"
 
 ClassImp(MBending);
@@ -262,8 +262,8 @@
     }
 
-    Timer t;
+    MTime t;
     t.Now();
 
-    fout << "MAGIC1 " << t.GetTimeStr() << endl;
+    fout << "MAGIC1 " << t << endl;
     fout << "S   00   000000   000000  0000000" << endl;
     fout << setprecision(8);
@@ -285,4 +285,65 @@
 }
 
+AltAz MBending::AddOffsets(const AltAz &aa) const
+{
+    // Correct [rad]
+    // zdaz    [rad]
+    AltAz p = aa;
+
+    const AltAz I(fIe, fIa);
+    p += I;
+
+    return p;
+}
+
+AltAz MBending::SubtractOffsets(const AltAz &aa) const
+{
+    // Correct [rad]
+    // zdaz    [rad]
+    AltAz p = aa;
+
+    const AltAz I(fIe, fIa);
+    p -= I;
+
+    return p;
+}
+
+AltAz MBending::CalcAnAw(const AltAz &p, Int_t sign) const
+{
+    // Corrections for AN and AW without approximations
+    // as done by Patrick Wallace. The approximation cannot
+    // be used for MAGIC because the correctioon angle
+    // AW (~1.5deg) is not small enough.
+
+    // Vector in cartesian coordinates
+    TVector3 v(1., 1., 1.); 
+
+    // Set Azimuth and Elevation
+    v.SetPhi(p.Az());
+    v.SetTheta(TMath::Pi()/2-p.Alt());
+
+    // Rotate around the x- and y-axis
+    v.RotateY(sign*fAn);
+    v.RotateX(sign*fAw);
+
+    // Calculate Delta Azimuth and Delta Elevation
+    AltAz d(TMath::Pi()/2-v.Theta(), v.Phi());
+    d -= p;
+    d *= sign;
+
+    // Fix 'direction' of output depending on input vector
+    if (sign*p.Alt()>TMath::Pi()/2)
+        d.Alt(d.Alt()-TMath::Pi());
+
+    // Align correction into [-180,180]
+    while (d.Az()>TMath::Pi())
+        d.Az(d.Az()-TMath::Pi()*2);
+    while (d.Az()<-TMath::Pi())
+        d.Az(d.Az()+TMath::Pi()*2);
+
+    return d;
+}
+
+
 AltAz MBending::Correct(const AltAz &aa) const
 {
@@ -350,29 +411,13 @@
     DEBUG(cout << "Bend2: " << 90-p.Alt()*180/TMath::Pi() << " " << p.Az()*180/TMath::Pi() << endl);
 
-    // New Corrections for AW and AN:
-    TVector3 v2(1.,1.,1.); // Vector in cartesian coordinates
-    // Set Azimuth and Elevation
-    v2.SetPhi(p.Az());
-    v2.SetTheta(TMath::Pi()/2-p.Alt());
-    // Rotate around the x- and y-axis
-    v2.RotateX(fAw);
-    v2.RotateY(fAn);
-    // Get Azimuth and Elevation
-    p.Az(v2.Phi());
-    p.Alt(TMath::Pi()/2-v2.Theta());
-
-    /*
-    // Old correction terms for An and Aw:
-    cout << fAw << " " << cos(p.Az()) << " " << tan(p.Alt()) << endl;
-    cout << fAw* cos(p.Az())*tan(p.Alt())*180/3.1415 << endl;
-
-    const AltAz AW( fAw*sin(p.Az()), -fAw*cos(p.Az())*tan(p.Alt()));
-    const AltAz AN(-fAn*cos(p.Az()), -fAn*sin(p.Az())*tan(p.Alt()));
-    p += AW;
-    p += AN;
+    const AltAz ANAW(CalcAnAw(p, -1));
+    p += ANAW;
+
+    /* Old correction terms for An and Aw:
+     const AltAz AW( fAw*sin(p.Az()), -fAw*cos(p.Az())*tan(p.Alt()));
+     const AltAz AN(-fAn*cos(p.Az()), -fAn*sin(p.Az())*tan(p.Alt()));
+     p += AW;
+     p += AN;
     */
-
-
-
 
     DEBUG(cout << "Bend1: " << 90-p.Alt()*180/TMath::Pi() << " " << p.Az()*180/TMath::Pi() << endl);
@@ -389,5 +434,5 @@
 }
 
-AltAz MBending::AddOffsets(const AltAz &aa) const
+AltAz MBending::CorrectBack(const AltAz &aa) const
 {
     // Correct [rad]
@@ -395,16 +440,4 @@
     AltAz p = aa;
 
-    const AltAz I(fIe, fIa);
-    p += I;
-
-    return p;
-}
-
-AltAz MBending::CorrectBack(const AltAz &aa) const
-{
-    // Correct [rad]
-    // zdaz    [rad]
-    AltAz p = aa;
-
     DEBUG(cout << setprecision(16));
     DEBUG(cout << "Back0: " << 90-p.Alt()*180/TMath::Pi() << " " << p.Az()*180/TMath::Pi() << endl);
@@ -418,6 +451,5 @@
     DEBUG(cout << "Back1: " << 90-p.Alt()*180/TMath::Pi() << " " << p.Az()*180/TMath::Pi() << endl);
 
-    /*
-     //Old correction terms for An and Aw:
+    /* Old correction terms for An and Aw:
      const AltAz AN(-fAn*cos(p.Az()), -fAn*sin(p.Az())*tan(p.Alt()));
      const AltAz AW( fAw*sin(p.Az()), -fAw*cos(p.Az())*tan(p.Alt()));
@@ -426,16 +458,6 @@
      */
 
-    // New Corrections for AN and AW:
-    TVector3 v(1.,1.,1.); // Vector in cartesian coordinates
-    // Set Azimuth and Elevation
-    v.SetPhi(p.Az());
-    v.SetTheta(TMath::Pi()/2-p.Alt());
-    // Rotate around the x- and y-axis
-    v.RotateY(-fAn);
-    v.RotateX(-fAw);
-    // Get Azimuth and Elevation
-    p.Az(v.Phi());
-    p.Alt(TMath::Pi()/2-v.Theta());
-
+    const AltAz ANAW(CalcAnAw(p, -1));
+    p -= ANAW;
 
     DEBUG(cout << "Back2: " << 90-p.Alt()*180/TMath::Pi() << " " << p.Az()*180/TMath::Pi() << endl);
@@ -498,17 +520,4 @@
 }
 
-AltAz MBending::SubtractOffsets(const AltAz &aa) const
-{
-    // Correct [rad]
-    // zdaz    [rad]
-    AltAz p = aa;
-
-    const AltAz I(fIe, fIa);
-    p -= I;
-
-    return p;
-}
-
-
 ZdAz MBending::Correct(const ZdAz &zdaz) const
 {
Index: /trunk/MagicSoft/Cosy/main/MBending.h
===================================================================
--- /trunk/MagicSoft/Cosy/main/MBending.h	(revision 2614)
+++ /trunk/MagicSoft/Cosy/main/MBending.h	(revision 2615)
@@ -53,4 +53,5 @@
 
     static Double_t Sign(Double_t val, Double_t alt);
+    AltAz CalcAnAw(const AltAz &p, Int_t sign) const;
 
 public:
Index: /trunk/MagicSoft/Cosy/main/MCaos.cc
===================================================================
--- /trunk/MagicSoft/Cosy/main/MCaos.cc	(revision 2614)
+++ /trunk/MagicSoft/Cosy/main/MCaos.cc	(revision 2615)
@@ -12,4 +12,6 @@
 #include <TCanvas.h>
 
+#include "MTime.h"
+
 #include "Led.h"
 #include "Ring.h"
@@ -18,5 +20,4 @@
 
 #include "coord.h"
-#include "base/timer.h"
 
 void MCaos::ReadResources(const char *name="leds.txt")
@@ -306,5 +307,5 @@
 }
 
-void MCaos::Run(byte *img, bool printl, bool printr, const ZdAz &pos, const Timer &t)
+void MCaos::Run(byte *img, bool printl, bool printr, const ZdAz &pos, const MTime &t)
 {
     Leds &leds = *fLeds;
@@ -354,6 +355,6 @@
 
     // FIXME!
-    static const Timer t0(t);
-    fEvtTime = (double)t-(double)t0;
+    static const MTime t0(t);
+    fEvtTime = t-t0;
 
     if (fHistpr)
Index: /trunk/MagicSoft/Cosy/main/MCaos.h
===================================================================
--- /trunk/MagicSoft/Cosy/main/MCaos.h	(revision 2614)
+++ /trunk/MagicSoft/Cosy/main/MCaos.h	(revision 2615)
@@ -15,5 +15,5 @@
 class TGraph;
 
-class Timer;
+class MTime;
 class ZdAz;
 
@@ -68,5 +68,5 @@
     void ResetHistograms();
 
-    void Run(byte *img, bool printl, bool printr, const ZdAz &pos, const Timer &t);
+    void Run(byte *img, bool printl, bool printr, const ZdAz &pos, const MTime &t);
 };
 
Index: /trunk/MagicSoft/Cosy/main/MCosy.cc
===================================================================
--- /trunk/MagicSoft/Cosy/main/MCosy.cc	(revision 2614)
+++ /trunk/MagicSoft/Cosy/main/MCosy.cc	(revision 2615)
@@ -18,4 +18,5 @@
 
 #include "MGCosy.h"
+#include "MTime.h"
 #include "MDriveCom.h"
 #include "MStarguider.h"
@@ -25,5 +26,4 @@
 
 #include "macs.h"
-#include "base/timer.h"
 #include "shaftencoder.h"
 
@@ -341,5 +341,5 @@
         return;
 
-    Timer t;
+    MTime t;
     t.Now();
     lout << t << " - MCosy::WaitForEndMovement aborted...";
@@ -449,5 +449,5 @@
     const ZdAz d = dst*kRad2Deg;
 
-    Timer t;
+    MTime t;
     t.Now();
     lout << t << " - Target Position: " << d.Zd() << "deg, " << d.Az() << "deg (Zd/Az)" << endl;
@@ -958,5 +958,5 @@
 
     sla.Now();
-    lout << sla << " - Start tracking:";
+    lout << sla.GetTime() << " - Start tracking:";
     lout << " Ra: " << xy.X() << "h  " << "Dec: " << xy.Y() << "\xb0" << endl;
 /*#ifdef EXPERT
@@ -1105,5 +1105,5 @@
     StopMovement();
 
-    lout << sla << " - Tracking stopped." << endl;
+    lout << sla.GetTime() << " - Tracking stopped." << endl;
 }
 
@@ -2184,5 +2184,5 @@
     fWin=new MGCosy(fObservatory, this, gClient->GetRoot(), 1, 1);
 }
-
+/*
 void MCosy::ConstructorSE(Int_t id4, Int_t id5, Int_t id6)
 {
@@ -2231,6 +2231,6 @@
     fWin=new MGCosy(fObservatory, this, gClient->GetRoot(), 1, 1);
 }
-
-MCosy::MCosy(int mode, const char *dev, const int baud, MLog &out)
+*/
+MCosy::MCosy(/*int mode,*/ const char *dev, const int baud, MLog &out)
 : Network(dev, baud, out), fObservatory(MObservatory::kMagic1), fStarguider(NULL), fZd1(0), fZd2(0), fAz(0), fMac1(0), fMac2(0), fMac3(0), fBackground(kBgdNone), fStatus(MDriveCom::kStopped)
 {
@@ -2242,12 +2242,12 @@
     const Int_t id5 = env.GetValue("Zd_Id-SE2",  5); //5
     const Int_t id6 = env.GetValue("Az_Id-SE",   6); //6
-
+/*
     lout << "- Program in ";
     switch (mode)
     {
     case 0:
-        lout << "<<Standard mode>>" << endl;
+        lout << "<<Standard mode>>" << endl;*/
         fBending.Load("bending.txt");
-        Constructor(id1, id2, id3, id4, id5, id6);
+        Constructor(id1, id2, id3, id4, id5, id6);/*
         break;
     case 1:
@@ -2260,5 +2260,5 @@
         ConstructorDemo();
     }
-
+*/
     lout.SetOutputGui(fWin->GetLog(), kTRUE);
 
@@ -2267,15 +2267,16 @@
     fAz->SetDisplay(fWin->GetLabel1());
 
-    int i=0;
-    char name[100];
+    //
+    // open tpoint file
+    //
+    MTime time;
+    TString name;
     while (1)
     {
-        sprintf(name, "tpoint/tpoint%03d.txt", i++);
+        time.Now();
+        name = Form("tpoint/tpoint_%s.txt", (const char*)time.GetFileName());
         if (gSystem->AccessPathName(name, kFileExists))
             break;
     }
-
-    Timer time;
-    time.Now();
 
     cout << "TPoint File ********* " << name << " ********** " << endl;
Index: /trunk/MagicSoft/Cosy/main/MCosy.h
===================================================================
--- /trunk/MagicSoft/Cosy/main/MCosy.h	(revision 2614)
+++ /trunk/MagicSoft/Cosy/main/MCosy.h	(revision 2615)
@@ -168,6 +168,6 @@
 
     void Constructor(Int_t id1, Int_t id2, Int_t id3, Int_t id4, Int_t id5, Int_t id6);
-    void ConstructorSE(Int_t id1, Int_t id2, Int_t id3);
-    void ConstructorDemo();
+    //void ConstructorSE(Int_t id1, Int_t id2, Int_t id3);
+    //void ConstructorDemo();
 
     void ReadConfig();
@@ -176,5 +176,5 @@
 
 public:
-    MCosy(int mode, const char *dev, const int baud, MLog &out=gLog);
+    MCosy(/*int mode,*/ const char *dev, const int baud, MLog &out=gLog);
     ~MCosy();
 
Index: /trunk/MagicSoft/Cosy/main/MStarguider.cc
===================================================================
--- /trunk/MagicSoft/Cosy/main/MStarguider.cc	(revision 2614)
+++ /trunk/MagicSoft/Cosy/main/MStarguider.cc	(revision 2615)
@@ -839,5 +839,5 @@
     static unsigned long n0 = n;
 
-    Timer t(tm);
+    MTime t(*tm);
 
     const Double_t d = t-fTime;
@@ -894,5 +894,5 @@
     if (fDisplay->IsEntryChecked(IDM_kCatalog))
     {
-        Timer time(tm);
+        MTime time(*tm);
 
         XY xy = fCRaDec->GetCoordinates();
@@ -934,4 +934,5 @@
     if (fDisplay->IsEntryChecked(IDM_kCatalog))
     {
+        // FIXME: Necessary?
         fSao->Now();
         AltAz aa = fSao->CalcAltAzFromPix(fDx, fDy)*kRad2Deg;
Index: /trunk/MagicSoft/Cosy/main/MStarguider.h
===================================================================
--- /trunk/MagicSoft/Cosy/main/MStarguider.h	(revision 2614)
+++ /trunk/MagicSoft/Cosy/main/MStarguider.h	(revision 2615)
@@ -5,7 +5,13 @@
 #include <TGFrame.h>
 #endif
+
 #include "PixClient.h"
+
 #ifndef MARS_MObservatory
 #include "MObservatory.h"
+#endif
+
+#ifndef MARS_MTime
+#include "MTime.h"
 #endif
 
@@ -14,5 +20,4 @@
 
 #include "coord.h"
-#include "timer.h"
 
 class TArrayF;
@@ -76,5 +81,5 @@
 
     TTimer *fTimer;
-    Timer   fTime;
+    MTime   fTime;
 
     Int_t fDx;
Index: /trunk/MagicSoft/Cosy/tcpip/MCeCoCom.cc
===================================================================
--- /trunk/MagicSoft/Cosy/tcpip/MCeCoCom.cc	(revision 2614)
+++ /trunk/MagicSoft/Cosy/tcpip/MCeCoCom.cc	(revision 2615)
@@ -26,5 +26,5 @@
     str.Remove(0, len);
 
-    fT.SetTimer(y, m, d, h, min, s, ms/1000.);
+    fT.Set(y, m, d, h, min, s, ms);
 
     // Remove the 30 tokens of the subsystem status
@@ -88,6 +88,15 @@
 bool MCeCoCom::Send(const char *str)
 {
-    Timer t;
+    MTime t;
     t.Now();
+
+    UShort_t y1, y2, ms1, ms2;
+    Byte_t mon1, mon2, d1, d2, h1, h2, m1, m2, s1, s2;
+
+    t.GetDate(y1, mon1, d1);
+    t.GetTime(h1, m1, s1, ms1);
+
+    fT.GetDate(y2, mon2, d2);
+    fT.GetTime(h2, m2, s2, ms2);
 
     const char *msg =
@@ -96,6 +105,6 @@
              "%02d %04d %02d %02d %02d %02d %02d %03d "
              "%s\n", (const char*)fCommand,
-             fStatus, t.Year(), t.Month(), t.Day(), t.H(), t.M(), t.S(), t.MilliSec(),
-             fComStat, fT.Year(), fT.Month(), fT.Day(), fT.H(), fT.M(), fT.S(), fT.MilliSec(),
+             fStatus,  y1, mon1, d1, h1, m1, s1, ms1,
+             fComStat, y2, mon2, d2, h2, m2, s2, ms2,
              str);
 
Index: /trunk/MagicSoft/Cosy/tcpip/MCeCoCom.h
===================================================================
--- /trunk/MagicSoft/Cosy/tcpip/MCeCoCom.h	(revision 2614)
+++ /trunk/MagicSoft/Cosy/tcpip/MCeCoCom.h	(revision 2615)
@@ -10,6 +10,6 @@
 #endif
 
-#ifndef COSY_Timer
-#include "timer.h"
+#ifndef MARS_MTime
+#include "MTime.h"
 #endif
 
@@ -25,5 +25,5 @@
 
     TString fCommand;     // report string of the current system
-    Timer   fT;           // time of last report received
+    MTime   fT;           // time of last report received
     char    fStatus;      // current status of this system
     int     fCCStatus;    // global status of CC
Index: /trunk/MagicSoft/Cosy/tcpip/MDriveCom.cc
===================================================================
--- /trunk/MagicSoft/Cosy/tcpip/MDriveCom.cc	(revision 2614)
+++ /trunk/MagicSoft/Cosy/tcpip/MDriveCom.cc	(revision 2615)
@@ -4,5 +4,5 @@
 
 #include "coord.h"
-#include "Slalib.h"
+#include "MAstro.h"
 #include "MCosy.h"
 
@@ -24,5 +24,5 @@
     str.Remove(0, len);
 
-    ret = Slalib::Dms2Deg(d, m, s, sgn);
+    ret = MAstro::Dms2Deg(d, m, s, sgn);
     return true;
 }
@@ -137,5 +137,5 @@
     UShort_t d, m, s;
 
-    Slalib::Deg2Dms(deg, sgn, d, m, s);
+    MAstro::Deg2Dms(deg, sgn, d, m, s);
 
     str += Form("%c %03d %02d %03d ", sgn, d, m, s);
@@ -161,5 +161,5 @@
         SetStatus(4);
 
-    Timer t;
+    MTime t;
     t.Now();
 
Index: /trunk/MagicSoft/Cosy/videodev/Writer.cc
===================================================================
--- /trunk/MagicSoft/Cosy/videodev/Writer.cc	(revision 2614)
+++ /trunk/MagicSoft/Cosy/videodev/Writer.cc	(revision 2615)
@@ -7,5 +7,5 @@
 #include <png.h>
 
-#include "base/timer.h"
+#include "MTime.h"
 
 ClassImp(Writer);
@@ -14,5 +14,5 @@
                  struct timeval *date)
 {
-    Timer t(date);
+    MTime t(*date);
     TString mjd;
     mjd += t.GetMjd()-52000;
@@ -129,5 +129,5 @@
     TString name = fname;
 
-    Timer t(date);
+    MTime t(*date);
 
     name += "_";
