Changeset 16196


Ignore:
Timestamp:
05/24/13 21:37:09 (11 years ago)
Author:
tbretz
Message:
Added a constructor with a timeval... fixed a problem with the time_t constructor
Location:
trunk/FACT++/src
Files:
2 edited

Legend:

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

    r16059 r16196  
    102102//
    103103Time::Time(const time_t &tm, const int &millisec)
    104 : ptime(fUnixOffset, time_duration(0, 0, tm, millisec))
     104: ptime(fUnixOffset, time_duration(0, 0, tm, millisec*pow(10, time_of_day().num_fractional_digits()-3)))
     105{
     106}
     107
     108// --------------------------------------------------------------------------
     109//
     110//! Construct a Time object from a struct timeval.
     111//!
     112//! @param tv
     113//!    struct timeval
     114//!
     115Time::Time(const timeval &tv)
     116: ptime(fUnixOffset, time_duration(0, 0, tv.tv_sec, tv.tv_usec*pow(10, time_of_day().num_fractional_digits()-6)))
    105117{
    106118}
  • trunk/FACT++/src/Time.h

    r16058 r16196  
    6363    Time(const boost::date_time::special_values &val);
    6464    Time(const time_t &tm, const int &ms);
     65    Time(const timeval &tm);
    6566    Time(const ptime &pt) : boost::posix_time::ptime(pt) { }
    6667    Time(short year, unsigned char month, unsigned char day,
Note: See TracChangeset for help on using the changeset viewer.