Changeset 18445 for trunk/FACT++/src


Ignore:
Timestamp:
02/17/16 14:03:38 (9 years ago)
Author:
tbretz
Message:
Instead of power and num_fractional_digits, ticks_per_second can directly be used.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/Time.cc

    r16978 r18445  
    148148        mjd -= 2400000.5;
    149149
    150     // Convert MJD to seconds since offset
     150    // Convert MJD to ticks since offset
    151151    mjd -= 40587;
    152     mjd *= 24*60*60;
    153 
    154     const double frac = fmod(mjd, 1)*pow(10, time_duration::num_fractional_digits());
    155 
    156     *this = ptime(fUnixOffset, time_duration(0, 0, mjd, frac));
     152    mjd *= 24*60*60*time_duration::ticks_per_second();
     153
     154    *this = ptime(fUnixOffset, time_duration(0, 0, 0, mjd));
    157155}
    158156
     
    165163    const time_duration tod = time_of_day();
    166164
    167     const double frac = tod.fractional_seconds()/pow(10, time_duration::num_fractional_digits());
     165    const double frac = double(tod.fractional_seconds())/time_duration::ticks_per_second();
    168166    const double sec  = tod.total_seconds()+frac;
    169167
Note: See TracChangeset for help on using the changeset viewer.