bes Updated for version 3.21.1
The Backend Server (BES) is the lower two tiers of the Hyrax data server
|
#include <DODS_Time.h>
Public Member Functions | |
Constructors | |
DODS_Time (string time) | |
DODS_Time (BaseType *arg) | |
DODS_Time (dods_uint32 hh, dods_uint32 mm, bool gmt=false) | |
DODS_Time (dods_uint32 hh, dods_uint32 mm, double ss, bool gmt=false) | |
DODS_Time () | |
Assignment | |
void | set (string time) |
void | set (BaseType *arg) |
void | set (int hh, int mm, bool gmt=false) |
void | set (int hh, int mm, double ss, bool gmt=false) |
Access | |
string | get (bool gmt=true) const |
int | hours () const |
int | minutes () const |
double | seconds () const |
bool | gmt () const |
double | seconds_since_midnight () const |
double | fraction () const |
Relational operators | |
bool | OK () const |
double | get_epsilon () const |
void | set_epsilon (double eps) |
int | operator== (DODS_Time &t1, DODS_Time &t2) |
Equality. | |
int | operator!= (DODS_Time &t1, DODS_Time &t2) |
Inequality. | |
int | operator< (DODS_Time &t1, DODS_Time &t2) |
Less-than. | |
int | operator> (DODS_Time &t1, DODS_Time &t2) |
Greater-than. | |
int | operator<= (DODS_Time &t1, DODS_Time &t2) |
Less-than or Equal-to. | |
int | operator>= (DODS_Time &t1, DODS_Time &t2) |
Greater-than or Equal-to. | |
The DODS Time object. This provides a way to translate between various representations of time. This class is designed to be compatible with the DODS_Date class so that dates and times may be used together in relational expressions.
NB: The seconds part of a DODS_Time may contain fractional components. To test for equality of times, this class tests to see if the second time falls within a neighborhood around the first time the size of which is determined by an epsilon value (1.0e-6 by default). Thus seconds may have precision down to the micro-second (depending on the underlying hardware). See the set_epsilon()# and get_epsilon()# mfuncs. The epsilon value is a static class member; the same value is used for all instances of the class, and when changed, is changed at that time for all instances.
Definition at line 63 of file DODS_Time.h.
DODS_Time::DODS_Time | ( | string | time | ) |
Build a DODS_Time by parsing the String #time#. The string may be either of the form ‘hh:mm:ss’ or ‘hh:mm’. In the later case the seconds are assumed to be zero. In addition, the string may have the suffix ‘GMT’ or ‘UTC’ indicating that the time is in Greenwich Mean Time.
time | The time string. |
DODS_Time::DODS_Time | ( | BaseType * | arg | ) |
Build a DODS_Time by parsing the DODS Str #arg#.
arg | A DODS Str variable, passed as a BaseType pointer. |
Definition at line 114 of file DODS_Time.cc.
DODS_Time::DODS_Time | ( | dods_uint32 | hh, |
dods_uint32 | mm, | ||
bool | gmt = false ) |
Build a DODS_Time.
hh | The hours, 0-23. |
mm | The minutes, 0-59. |
gmt | True if the time is a GMT time, false otherwise. |
Definition at line 119 of file DODS_Time.cc.
DODS_Time::DODS_Time | ( | dods_uint32 | hh, |
dods_uint32 | mm, | ||
double | ss, | ||
bool | gmt = false ) |
Build a DODS_Time.
hh | The hours, 0–23. |
mm | The minutes, 0–59. |
ss | The seconds, 0–59. May contain a fractional component. |
gmt | True if the time is a GMT time, false otherwise. |
Definition at line 129 of file DODS_Time.cc.
DODS_Time::DODS_Time | ( | ) |
Build an empty DODS_Time.
NB: This won't pass the class invariant.
Definition at line 104 of file DODS_Time.cc.
double DODS_Time::fraction | ( | ) | const |
Get the time as a fraction of a day.
Definition at line 94 of file DODS_Time.cc.
Get the string representation of time.
gmt | If true append the suffix ‘GMT’ to the time if it a GMT time. If false, ignore gmt. True by default. |
Definition at line 294 of file DODS_Time.cc.
double DODS_Time::get_epsilon | ( | ) | const |
Get the value of epsilon used for equality tests.
Definition at line 211 of file DODS_Time.cc.
bool DODS_Time::gmt | ( | ) | const |
Definition at line 288 of file DODS_Time.cc.
int DODS_Time::hours | ( | ) | const |
Definition at line 270 of file DODS_Time.cc.
int DODS_Time::minutes | ( | ) | const |
Definition at line 276 of file DODS_Time.cc.
bool DODS_Time::OK | ( | ) | const |
Class invariant.
Definition at line 85 of file DODS_Time.cc.
double DODS_Time::seconds | ( | ) | const |
Definition at line 282 of file DODS_Time.cc.
double DODS_Time::seconds_since_midnight | ( | ) | const |
Get the number of seconds since midnight.
Definition at line 264 of file DODS_Time.cc.
void DODS_Time::set | ( | BaseType * | arg | ) |
Set the value by parsing the DODS Str #arg#.
arg | The time string wrapped in a DODS string. |
Definition at line 184 of file DODS_Time.cc.
Set the value using the given numeric values.
hh | The hours, 0-23. |
mm | The minutes, 0-59. |
gmt | True if the time is a GMT time, false otherwise. |
Definition at line 190 of file DODS_Time.cc.
Set the value using the given numeric values.
hh | The hours, 0–23. |
mm | The minutes, 0–59. |
ss | The seconds, 0–59. May contain a fractional component. |
gmt | True if the time is a GMT time, false otherwise. |
Definition at line 196 of file DODS_Time.cc.
void DODS_Time::set | ( | string | time | ) |
Set the value by parsing the string #time#.
time | The time string. |
Definition at line 140 of file DODS_Time.cc.
void DODS_Time::set_epsilon | ( | double | eps | ) |
Set the value of epsilon used for equality tests. By default the value is 0.000001 (10e-6).
Definition at line 217 of file DODS_Time.cc.
Inequality.
Definition at line 230 of file DODS_Time.cc.
Less-than.
Definition at line 251 of file DODS_Time.cc.
Less-than or Equal-to.
Definition at line 257 of file DODS_Time.cc.
Equality.
Definition at line 223 of file DODS_Time.cc.
Greater-than.
Definition at line 240 of file DODS_Time.cc.
Greater-than or Equal-to.
Definition at line 246 of file DODS_Time.cc.