DABC (Data Acquisition Backbone Core)
2.9.9
|
Class for holding GMT time with precision of nanoseconds. More...
#include <dabc/timing.h>
Public Member Functions | |
double | AsDouble () const |
Return date and time in seconds since 1.1.1970. More... | |
uint64_t | AsJSDate () const |
Return date and time in JS format - number of millisecond since 1.1.1970. More... | |
std::string | AsJSString (int ndecimal=3) const |
convert string into sec.frac format, can be interpret directly in JavaScript ISO 8601 standard is used and produces string like '2013-09-16T12:42:30.884Z' Time in GMT time zone More... | |
std::string | AsString (int ndecimal=0, bool localtime=false) const |
convert string into human-readable format, cannot be interpret directly in JavaScript More... | |
unsigned | AsUTCSeconds () const |
Returns only seconds since 1.1.1970. More... | |
DateTime () | |
DateTime (const DateTime &src) | |
DateTime (uint64_t jsdate) | |
double | DistanceTo (const DateTime &src) const |
Return distance in seconds to provided date. More... | |
DateTime & | GetNow () |
bool | null () const |
std::string | OnlyDateAsString (const char *separ=nullptr, bool localtime=false) const |
Fills only date as string. More... | |
std::string | OnlyTimeAsString (const char *separ=nullptr, bool localtime=false) const |
Fills only time as string. More... | |
double | operator- (const DateTime &src) const |
DateTime & | operator= (const DateTime &src) |
void | SetDouble (double v) |
Set value in form of double - seconds since 1.1.1970. More... | |
void | SetJSDate (uint64_t jsdate) |
Set value in form of JS date - milliseconds since 1.1.1970. More... | |
bool | SetOnlyDate (const char *sbuf) |
Set only date part from the string. More... | |
bool | SetOnlyTime (const char *sbuf) |
Set only time part of DateTime. More... | |
Protected Attributes | |
unsigned | tv_nsec |
unsigned | tv_sec |
Class for holding GMT time with precision of nanoseconds.
For time measurement function like gettimeofday is used.
|
inline |
dabc::DateTime & dabc::DateTime::GetNow | ( | ) |
Definition at line 147 of file timing.cxx.
double dabc::DateTime::AsDouble | ( | ) | const |
Return date and time in seconds since 1.1.1970.
Definition at line 206 of file timing.cxx.
uint64_t dabc::DateTime::AsJSDate | ( | ) | const |
Return date and time in JS format - number of millisecond since 1.1.1970.
Definition at line 158 of file timing.cxx.
|
inline |
|
inline |
|
inline |
std::string dabc::DateTime::AsString | ( | int | ndecimal = 0 , |
bool | localtime = false |
||
) | const |
convert string into human-readable format, cannot be interpret directly in JavaScript
Definition at line 164 of file timing.cxx.
std::string dabc::DateTime::AsJSString | ( | int | ndecimal = 3 | ) | const |
convert string into sec.frac format, can be interpret directly in JavaScript ISO 8601 standard is used and produces string like '2013-09-16T12:42:30.884Z' Time in GMT time zone
Definition at line 212 of file timing.cxx.
std::string dabc::DateTime::OnlyDateAsString | ( | const char * | separ = nullptr , |
bool | localtime = false |
||
) | const |
Fills only date as string.
Definition at line 257 of file timing.cxx.
std::string dabc::DateTime::OnlyTimeAsString | ( | const char * | separ = nullptr , |
bool | localtime = false |
||
) | const |
Fills only time as string.
Definition at line 273 of file timing.cxx.
bool dabc::DateTime::SetOnlyDate | ( | const char * | sbuf | ) |
Set only date part from the string.
Definition at line 289 of file timing.cxx.
bool dabc::DateTime::SetOnlyTime | ( | const char * | sbuf | ) |
Set only time part of DateTime.
Definition at line 308 of file timing.cxx.
double dabc::DateTime::DistanceTo | ( | const DateTime & | src | ) | const |
Return distance in seconds to provided date.
Definition at line 332 of file timing.cxx.