]>
Commit | Line | Data |
---|---|---|
3ea81e9c | 1 | #ifndef ALITIMESTAMP_H |
2 | #define ALITIMESTAMP_H | |
3 | /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
4 | * See cxx source for full Copyright notice */ | |
5 | ||
6 | // $Id$ | |
7 | ||
145c9890 | 8 | #include <math.h> |
9 | ||
3ea81e9c | 10 | #include "TTimeStamp.h" |
11 | #include "TString.h" | |
12 | ||
13 | class AliTimestamp : public TTimeStamp | |
14 | { | |
15 | public: | |
16 | AliTimestamp(); // Default constructor | |
17 | AliTimestamp(TTimeStamp& t); // Constructor | |
18 | virtual ~AliTimestamp(); // Destructor | |
19 | AliTimestamp(const AliTimestamp& t); // Copy constructor | |
e47fe004 | 20 | void Date(Int_t mode=3,Double_t offset=0); // Print date/time info |
3ea81e9c | 21 | Double_t GetJD(Int_t y,Int_t m,Int_t d,Int_t hh,Int_t mm,Int_t ss,Int_t ns) const; // Julian Date from input args. |
22 | Double_t GetMJD(Int_t y,Int_t m,Int_t d,Int_t hh,Int_t mm,Int_t ss,Int_t ns) const;// Modified JD from input args. | |
23 | Double_t GetTJD(Int_t y,Int_t m,Int_t d,Int_t hh,Int_t mm,Int_t ss,Int_t ns) const;// Truncated JD from input args. | |
24 | Double_t GetJE(Double_t date,TString mode="jd") const; // Julian Epoch corresponding to specified Julian Date | |
a4f7a3a1 | 25 | Double_t GetBE(Double_t date,TString mode="jd") const; // Besselian Epoch corresponding to specified Julian Date |
3ea81e9c | 26 | void Convert(Double_t date,Int_t& days,Int_t& secs,Int_t& ns) const;// Convert frac. day count into days, secs and ns |
27 | Double_t Convert(Int_t days,Int_t secs,Int_t ns) const; // Convert days, secs and ns into frac. day count | |
a4f7a3a1 | 28 | void Convert(Double_t h,Int_t& hh,Int_t& mm,Int_t& ss,Int_t& ns,Int_t& ps) const;// Convert frac. hour count |
29 | Double_t Convert(Int_t hh,Int_t mm,Int_t ss,Int_t ns,Int_t ps) const; // Convert hh:mm:ss:ns:ps into frac. hour | |
3ea81e9c | 30 | void GetMJD(Int_t& mjd,Int_t& sec,Int_t& ns); // Provide corresponding Modified Julian Date and time |
31 | Double_t GetMJD(); // Provide corresponding Modified Julian Date in fractional days | |
32 | void GetTJD(Int_t& mjd,Int_t& sec,Int_t& ns); // Provide corresponding Truncated Julian Date and time | |
33 | Double_t GetTJD(); // Provide corresponding Truncated Julian Date in fractional days | |
34 | void GetJD(Int_t& jd,Int_t& sec,Int_t& ns); // Provide corresponding Julian Date and time | |
35 | Double_t GetJD(); // Provide corresponding Julian Date in fractional days | |
36 | Double_t GetJE(); // Provide corresponding Julian Epoch | |
a4f7a3a1 | 37 | Double_t GetBE(); // Provide corresponding Besselian Epoch |
38 | Double_t GetJD(Double_t e,TString mode="J") const; // Provide fractional Julian Date from Epoch | |
39 | Double_t GetMJD(Double_t e,TString mode="J") const; // Provide fractional Modified Julian Date from Epoch | |
40 | Double_t GetTJD(Double_t e,TString mode="J") const; // Provide fractional Truncated Julian Date from Epoch | |
a7dc0627 | 41 | void SetMJD(Int_t mjd,Int_t sec,Int_t ns,Int_t ps=0); // Set Modified Julian Date and time |
42 | void SetMJD(Double_t mjd); // Set Modified Julian Date and time | |
43 | void SetJD(Int_t jd,Int_t sec,Int_t ns,Int_t ps=0); // Set Julian Date and time | |
44 | void SetJD(Double_t jd); // Set Julian Date and time | |
45 | void SetTJD(Int_t tjd,Int_t sec,Int_t ns,Int_t ps=0); // Set Truncated Julian Date and time | |
46 | void SetTJD(Double_t tjd); // Set Truncated Julian Date and time | |
95cfc777 | 47 | void SetNs(Int_t ns); // Set the remaining fractional number of sec in nanoseconds |
48 | Int_t GetNs() const; // Provide remaining fractional number of sec in nanoseconds | |
49 | void SetPs(Int_t ps); // Set the remaining fractional number of ns in picoseconds | |
50 | Int_t GetPs() const; // Provide remaining fractional number of ns in picoseconds | |
51 | using TTimeStamp::Add; | |
52 | void Add(Int_t d,Int_t s,Int_t ns,Int_t ps=0); // Add (or subtract) a certain time difference | |
e47fe004 | 53 | void Add(Double_t hours); // Add (or subtract) a certain time difference |
ee26083f | 54 | Int_t GetDifference(AliTimestamp* t,Int_t& days,Int_t& sec,Int_t& ns,Int_t& ps); // Provide time difference |
55 | Int_t GetDifference(AliTimestamp& t,Int_t& days,Int_t& sec,Int_t& ns,Int_t& ps); // Provide time difference | |
56 | Double_t GetDifference(AliTimestamp* t,TString u,Int_t mode=1); // Provide time diff. in specified units | |
57 | Double_t GetDifference(AliTimestamp& t,TString u,Int_t mode=1); // Provide time diff. in specified units | |
0cfe76b5 | 58 | void SetUT(Int_t y,Int_t m,Int_t d,Int_t hh,Int_t mm,Int_t ss,Int_t ns=0,Int_t ps=0); // Set specified UT |
59 | void SetUT(Int_t y,Int_t d,Int_t s,Int_t ns=0,Int_t ps=0); // Set UT based on elapsed days, secs etc... | |
a4f7a3a1 | 60 | void GetUT(Int_t& hh,Int_t& mm,Int_t& ss,Int_t& ns,Int_t& ps); // Provide corresponding UT |
61 | Double_t GetUT(); // Provide corresponding UT in fractional hours | |
62 | void GetGST(Int_t& hh,Int_t& mm,Int_t& ss,Int_t& ns,Int_t& ps); // Corresponding Greenwich Sidereal Time (GST) | |
63 | Double_t GetGST(); // Provide corresponding Greenwich Sidereal Time (GST) in fractional hours | |
3ea81e9c | 64 | |
65 | protected: | |
66 | Int_t fMJD; // Modified Julian Date | |
67 | Int_t fJsec; // Number of seconds elapsed within the MJD | |
68 | Int_t fJns; // Remaining fractional number of seconds (in nanoseconds) elapsed within the MJD | |
a7dc0627 | 69 | Int_t fJps; // Remaining fractional number of nanoseconds (in picoseconds) elapsed within the MJD |
3ea81e9c | 70 | |
71 | private: | |
72 | void FillJulian(); // Calculation and setting of the corresponding Julian parameters | |
73 | Int_t fCalcs; // The TTimeStamp seconds counter value at Julian parameter calculation | |
74 | Int_t fCalcns; // The TTimeStamp nanoseconds counter value at Julian parameter calculation | |
75 | ||
e47fe004 | 76 | ClassDef(AliTimestamp,8) // Handling of timestamps for (astro)particle physics research. |
3ea81e9c | 77 | }; |
78 | #endif |