Beamlib 3.1.2
This is the Beam C++ class library.
|
A date and time storage class with microsecond resolution. More...
#include <BTimeStamp.h>
Public Member Functions | |
BTimeStamp () | |
BTimeStamp (int year, int month=1, int day=1, int hour=0, int minute=0, int second=0, int microsecond=0) | |
BTimeStamp (const BString str) | |
~BTimeStamp () | |
void | clear () |
Clear the date/time. More... | |
void | setFirst () |
Set the first date available. More... | |
void | setLast () |
Set the last date available. More... | |
void | set (time_t time, int microSeconds) |
Set time using Unix time (seconds from 1970-01-01) More... | |
void | set (int year=0, int month=1, int day=1, int hour=0, int minute=0, int second=0, int microsecond=0) |
void | set (const BTimeStampMs &timeStamp) |
Set the timeStamp to given MS time stamp. More... | |
void | setYDay (int year=0, int yday=0, int hour=0, int minute=0, int second=0, int microsecond=0) |
void | setTime (int hour=0, int minute=0, int second=0, int microsecond=0) |
void | setNow () |
Set the timeStamp to now. More... | |
int | year () const |
int | yday () const |
int | month () const |
int | day () const |
int | hour () const |
int | minute () const |
int | second () const |
int | microSecond () const |
void | getDate (int &year, int &mon, int &day) const |
BString | getString (BString separator="T") const |
Get the time as an ISO date/time string. More... | |
BError | setString (const BString dateTime) |
Set the time from an ISO date/time. More... | |
BString | getStringNoMs (BString separator="T") const |
Get the time as an ISO date/time string without microseconds. More... | |
BString | getStringFormatted (BString format) const |
Gets the time in a string form as per the format. Format syntax as per strftime() More... | |
void | addMilliSeconds (int milliSeconds) |
Add the given number of milli seconds. This should be less that a year. More... | |
void | addMicroSeconds (int64_t microSeconds) |
Add the given number of micro seconds. This should be less that a year. More... | |
void | addSeconds (int seconds) |
Add the given number of seconds. This should be less that a year. More... | |
uint32_t | getYearSeconds () const |
Get number of seconds within the year. More... | |
uint64_t | getYearMicroSeconds () const |
Get number of micro seconds within the year. More... | |
int | isSet () const |
int | compare (const BTimeStamp &timeStamp) const |
Compare two dates. More... | |
operator BString () const | |
BTimeStamp & | operator= (const BTimeStampMs &timeStamp) |
int | operator== (const BTimeStamp &timeStamp) const |
int | operator!= (const BTimeStamp &timeStamp) const |
int | operator> (const BTimeStamp &timeStamp) const |
int | operator>= (const BTimeStamp &timeStamp) const |
int | operator< (const BTimeStamp &timeStamp) const |
int | operator<= (const BTimeStamp &timeStamp) const |
Static Public Member Functions | |
static int | isLeap (int year) |
static BInt64 | difference (BTimeStamp t2, BTimeStamp t1) |
Public Attributes | |
BUInt16 | oyear |
Year (0 .. 65535) More... | |
BUInt16 | oyday |
Day in year (0 .. 365) More... | |
BUInt8 | ohour |
Hour (0 .. 23) More... | |
BUInt8 | ominute |
Minute (0 .. 59) More... | |
BUInt8 | osecond |
Second (0 .. 59) More... | |
BUInt8 | ospare |
Padding. More... | |
BUInt32 | omicroSecond |
MicroSecond (0 .. 999999) More... | |
A date and time storage class with microsecond resolution.
BTimeStamp::BTimeStamp | ( | ) |
BTimeStamp::BTimeStamp | ( | int | year, |
int | month = 1 , |
||
int | day = 1 , |
||
int | hour = 0 , |
||
int | minute = 0 , |
||
int | second = 0 , |
||
int | microsecond = 0 |
||
) |
BTimeStamp::BTimeStamp | ( | const BString | str | ) |
BTimeStamp::~BTimeStamp | ( | ) |
void BTimeStamp::clear | ( | ) |
Clear the date/time.
void BTimeStamp::setFirst | ( | ) |
Set the first date available.
void BTimeStamp::setLast | ( | ) |
Set the last date available.
void BTimeStamp::set | ( | time_t | time, |
int | microSeconds | ||
) |
Set time using Unix time (seconds from 1970-01-01)
void BTimeStamp::set | ( | int | year = 0 , |
int | month = 1 , |
||
int | day = 1 , |
||
int | hour = 0 , |
||
int | minute = 0 , |
||
int | second = 0 , |
||
int | microsecond = 0 |
||
) |
void BTimeStamp::set | ( | const BTimeStampMs & | timeStamp | ) |
Set the timeStamp to given MS time stamp.
void BTimeStamp::setYDay | ( | int | year = 0 , |
int | yday = 0 , |
||
int | hour = 0 , |
||
int | minute = 0 , |
||
int | second = 0 , |
||
int | microsecond = 0 |
||
) |
void BTimeStamp::setTime | ( | int | hour = 0 , |
int | minute = 0 , |
||
int | second = 0 , |
||
int | microsecond = 0 |
||
) |
void BTimeStamp::setNow | ( | ) |
Set the timeStamp to now.
int BTimeStamp::year | ( | ) | const |
int BTimeStamp::yday | ( | ) | const |
int BTimeStamp::month | ( | ) | const |
int BTimeStamp::day | ( | ) | const |
int BTimeStamp::hour | ( | ) | const |
int BTimeStamp::minute | ( | ) | const |
int BTimeStamp::second | ( | ) | const |
int BTimeStamp::microSecond | ( | ) | const |
void BTimeStamp::getDate | ( | int & | year, |
int & | mon, | ||
int & | day | ||
) | const |
Get the time as an ISO date/time string.
Set the time from an ISO date/time.
This accepts a string and parses for a supported datetime format string. The function will return an error if it cannot parse a datatime string or if one of the parsed fields is out of range. The conversion supports a fractional second resolution of 1 microsecond rounding the fractional value given to this. Supported formats include: ISO: YYYY-MM-DD[ T]HH:MM:SS.FS, UK: YYYY/MM/DD[ T]HH:MM:SS.FS, UK: YY/MM/DD[ T]HH:MM:SS.FS, HH:MM:SS.FS and YYYYDDD[ T]HH:MM:SS.FS.
Get the time as an ISO date/time string without microseconds.
Gets the time in a string form as per the format. Format syntax as per strftime()
void BTimeStamp::addMilliSeconds | ( | int | milliSeconds | ) |
Add the given number of milli seconds. This should be less that a year.
void BTimeStamp::addMicroSeconds | ( | int64_t | microSeconds | ) |
Add the given number of micro seconds. This should be less that a year.
void BTimeStamp::addSeconds | ( | int | seconds | ) |
Add the given number of seconds. This should be less that a year.
uint32_t BTimeStamp::getYearSeconds | ( | ) | const |
Get number of seconds within the year.
uint64_t BTimeStamp::getYearMicroSeconds | ( | ) | const |
Get number of micro seconds within the year.
|
inline |
int BTimeStamp::compare | ( | const BTimeStamp & | timeStamp | ) | const |
Compare two dates.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
static |
|
static |
BUInt16 BTimeStamp::oyear |
Year (0 .. 65535)
BUInt16 BTimeStamp::oyday |
Day in year (0 .. 365)
BUInt8 BTimeStamp::ohour |
Hour (0 .. 23)
BUInt8 BTimeStamp::ominute |
Minute (0 .. 59)
BUInt8 BTimeStamp::osecond |
Second (0 .. 59)
BUInt8 BTimeStamp::ospare |
Padding.
BUInt32 BTimeStamp::omicroSecond |
MicroSecond (0 .. 999999)