Changeset 10460 for trunk/FACT++
- Timestamp:
- 04/26/11 11:35:40 (14 years ago)
- Location:
- trunk/FACT++/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/Time.cc
r10454 r10460 130 130 } 131 131 132 double_t Time::SecondsOfDay() const 133 { 134 const time_duration tod = time_of_day(); 135 136 const int exp = tod.num_fractional_digits(); 137 138 const double frac = tod.fractional_seconds()/pow(10, exp); 139 const double sec = tod.total_seconds()+frac; 140 141 return sec; 142 } 143 132 144 // -------------------------------------------------------------------------- 133 145 // … … 141 153 double Time::Mjd() const 142 154 { 143 const time_duration tod = time_of_day(); 144 145 const int exp = tod.num_fractional_digits(); 146 147 const double frac = tod.fractional_seconds()/pow(10, exp); 148 const double sec = tod.total_seconds()+frac; 149 150 return date().modjulian_day()+sec/(24*60*60); 155 return date().modjulian_day()+SecondsOfDay()/(24*60*60); 151 156 152 157 /* … … 161 166 // Return seconds since 1970/1/1 162 167 // 163 time_t Time::GetUnixTime() const 164 { 165 const time_duration unx = *this - ptime(fUnixOffset); 166 return unx.total_seconds(); 168 double Time::UnixTime() const 169 { 170 return (date().modjulian_day()-40587)*24*60*60 + SecondsOfDay(); 171 } 172 173 double Time::RootTime() const 174 { 175 return (date().modjulian_day()-49718)*24*60*60 + SecondsOfDay(); 167 176 } 168 177 -
trunk/FACT++/src/Time.h
r10454 r10460 91 91 unsigned int us() const { return time_of_day().total_microseconds()%1000000; } 92 92 93 time_t GetUnixTime() const;93 double SecondsOfDay() const; 94 94 95 double UnixTime() const; 96 double RootTime() const; 95 97 }; 96 98
Note:
See TracChangeset
for help on using the changeset viewer.