FACT++
1.0
|
Adds some functionality to boost::posix_time::ptime for our needs. More...
#include <Time.h>
Public Types | |
enum | init_t { none, utc, local } |
set to format to the MAGIC report format (without the fraction of seconds) More... | |
Public Member Functions | |
Time (enum init_t type=utc) | |
Time (const boost::date_time::special_values &val) | |
Time (const time_t &tm, const suseconds_t &us) | |
Time (const timeval &tm) | |
Time (const ptime &pt) | |
Time (short year, unsigned char month, unsigned char day, unsigned char h=0, unsigned char m=0, unsigned char s=0, unsigned int us=0) | |
Time (double mjd) | |
Time (const std::string &str) | |
std::string | GetAsStr (const char *fmt="%Y-%m-%d %H:%M:%S") const |
void | SetFromStr (const std::string &str, const char *fmt="%Y-%m-%d %H:%M:%S") |
std::string | Iso () const |
void | Mjd (double mjd) |
double | Mjd () const |
double | JD () const |
bool | IsValid () const |
bool | operator! () const |
unsigned short | Y () const |
unsigned short | M () const |
unsigned short | D () const |
unsigned short | h () const |
unsigned short | m () const |
unsigned short | s () const |
unsigned int | ms () const |
unsigned int | us () const |
double | SecondsOfDay () const |
time_t | Time_t () const |
double | UnixTime () const |
double | UnixDate () const |
double | RootTime () const |
uint64_t | JavaDate () const |
std::string | MinutesTo (const Time &=Time()) const |
std::string | SecondsTo (const Time &=Time()) const |
Time | GetPrevSunRise (double horizon) const |
Time | GetNextSunRise (double horizon) const |
Time | GetPrevSunRise () const |
Calls GetPrevSunRise(LN_SOLAR_STANDART_HORIZON) More... | |
Time | GetNextSunRise () const |
Calls GetNextSunRise(LN_SOLAR_STANDART_HORIZON) More... | |
uint32_t | NightAsInt () const |
Static Public Member Functions | |
static const _time_format | fmt (const char *txt=0) |
A stream manipulator to set the output/input format. More... | |
Static Public Attributes | |
static const Time | None |
A none-time, this can be used as a simple representation of an invalid time. More... | |
static const _time_format | reset = 0 |
static const _time_format | def = "%c" |
Remove the format description from the stream. More... | |
static const _time_format | std = "%x %X%F" |
set to format to the locale default More... | |
static const _time_format | sql = "%Y-%m-%d %H:%M:%S.%f" |
set to format to the iso standard More... | |
static const _time_format | ssql = "%Y-%m-%d %H:%M:%S" |
set to format to the sql format More... | |
static const _time_format | iso = "%Y-%m-%dT%H:%M:%S%F%q" |
set to format to the sql format (without the fraction of seconds) More... | |
static const _time_format | magic = "%Y %m %d %H %M %S %f" |
set to format to the extended iso standard More... | |
static const _time_format | smagic = "%Y %m %d %H %M %S" |
set to format to the MAGIC report format More... | |
static const boost::gregorian::date | fUnixOffset |
Points to the famous 1/1/1970, the standard offset for unix times. More... | |
Adds some functionality to boost::posix_time::ptime for our needs.
This is basically a wrapper around boost::posix_time::ptime which is made to adapt the functionality to our needs. Time can store the current data and time with a precision up to nanoseconds if provided by the undrlaying system, otherwise microsecond precision is used.
It main purpose is to provide needed constructors and simplyfy the conversion of dates and times from and to a string/stream.
Note that posix_time (as Posix times have) has a limited range. You cannot use it for example for very early years of the last century.