MySQL++
3.3.0
|
C++ form of SQL's TIME type. More...
#include <datetime.h>
Public Member Functions | |
Time () | |
Default constructor. | |
Time (unsigned char h, unsigned char m, unsigned char s) | |
Initialize object. More... | |
Time (const Time &other) | |
Initialize object as a copy of another Time. | |
Time (const DateTime &other) | |
Initialize object from time part of date/time object. | |
Time (const char *str) | |
Initialize object from a C string containing a SQL time string. More... | |
template<class Str > | |
Time (const Str &str) | |
Initialize object from a C++ string containing a SQL time string. More... | |
Time (time_t t) | |
Initialize object from a time_t . More... | |
int | compare (const Time &other) const |
Compare this time to another. More... | |
const char * | convert (const char *) |
Parse a SQL time string into this object. | |
unsigned char | hour () const |
Get the time's hour part, 0-255. | |
void | hour (unsigned char h) |
Change the time's hour part, 0-255. | |
unsigned char | minute () const |
Get the time's minute part, 0-59. | |
void | minute (unsigned char m) |
Change the time's minute part, 0-59. | |
operator std::string () const | |
Convert to std::string. | |
operator time_t () const | |
Convert to time_t. More... | |
unsigned char | second () const |
Get the time's second part, 0-59. | |
void | second (unsigned char s) |
Change the time's second part, 0-59. | |
std::string | str () const |
Return our value in std::string form. | |
Public Member Functions inherited from mysqlpp::Comparable< Time > | |
bool | operator== (const Time &other) const |
Returns true if "other" is equal to this object. | |
bool | operator!= (const Time &other) const |
Returns true if "other" is not equal to this object. | |
bool | operator< (const Time &other) const |
Returns true if "other" is less than this object. | |
bool | operator<= (const Time &other) const |
Returns true if "other" is less than or equal to this object. | |
bool | operator> (const Time &other) const |
Returns true if "other" is greater than this object. | |
bool | operator>= (const Time &other) const |
Returns true if "other" is greater than or equal to this object. | |
Additional Inherited Members | |
Protected Member Functions inherited from mysqlpp::Comparable< Time > | |
virtual | ~Comparable () |
Destroy object. More... | |
C++ form of SQL's TIME type.
Objects of this class can be inserted into streams, and initialized from SQL TIME strings.
|
inline |
Initialize object.
h | hour, 0-255 (yes, > 1 day is legal in SQL!) |
m | minute, 0-59 |
s | second, 0-59 |
|
inlineexplicit |
Initialize object from a C string containing a SQL time string.
String must be in the HH:MM:SS format. It doesn't have to be zero-padded.
|
inlineexplicit |
Initialize object from a C++ string containing a SQL time string.
This works with any stringish class that declares a c_str() member function: std::string, mysqlpp::String...
|
explicit |
Initialize object from a time_t
.
Naturally, we throw away the "date" part of the time_t
. If you need to keep it, you want to use DateTime instead.
|
virtual |
Compare this time to another.
Returns < 0 if this time is before the other, 0 of they are equal, and > 0 if this time is after the other.
Implements mysqlpp::Comparable< Time >.
mysqlpp::Time::operator time_t | ( | ) | const |
Convert to time_t.
The "date" part of the time_t
is "today"