#include <DataType.h>
Public Member Functions | |
Time () | |
Time (int hours, int mins, int secs, int usec=0) | |
Overloaded constructor. | |
Time (int totalSecs) | |
Time (const Time &d2) | |
Time & | operator= (const Time &d2) |
int | set (int hours, int mins, int secs, int usec=0) |
sets the time with specified hours, mins, secs | |
int | get (int &hours, int &mins, int &secs) const |
retrieves the time using IN parameters | |
bool | isValid () const |
checks for the validity of the time | |
void | setNull () |
resets the time | |
int | secondsSinceMidnight () const |
int | usec () const |
returns the microsecs | |
int | msec () const |
returns the millisecs | |
int | seconds () const |
returns the secs | |
int | minutes () const |
returns the minutes | |
int | hours () const |
returns the hours | |
int | setMsec (int ms) |
sets the millisecs | |
int | setUsec (int us) |
sets the microsecs | |
int | parseFrom (const char *s) |
parses the time string passed and stores it It should of the format "hh:mm::ss" | |
Time & | operator++ () |
Time & | operator-- () |
Time & | operator+= (int seconds) |
Time & | operator-= (int seconds) |
Static Public Member Functions | |
static bool | isValidTime (int hours, int mins, int secs) |
checks for the validity of the time specified | |
Friends | |
Time | operator+ (const Time &t1, int seconds) |
Time | operator+ (int seconds, const Time &t1) |
Time | operator- (const Time &t1, int seconds) |
int | operator- (const Time &t1, const Time &t2) |
int | operator< (const Time &t1, const Time &t2) |
int | operator> (const Time &t1, const Time &t2) |
int | operator<= (const Time &t1, const Time &t2) |
int | operator>= (const Time &t1, const Time &t2) |
int | operator== (const Time &t1, const Time &t2) |
int | operator!= (const Time &t1, const Time &t2) |
Definition at line 347 of file DataType.h.
Time::Time | ( | ) | [inline] |
Time::Time | ( | int | hours, | |
int | mins, | |||
int | secs, | |||
int | usec = 0 | |||
) |
Time::Time | ( | int | totalSecs | ) | [inline] |
Time::Time | ( | const Time & | d2 | ) | [inline] |
int Time::get | ( | int & | hours, | |
int & | mins, | |||
int & | secs | |||
) | const |
retrieves the time using IN parameters
hours | hours | |
mins | mins | |
secs | secs |
Definition at line 220 of file DataType.cxx.
Referenced by TimeStamp::getTime().
00220 { 00221 if (timeVal < 0) return -1; 00222 int s = timeVal/10000; 00223 secs = s % 60; 00224 s /= 60; 00225 mins = s % 60; 00226 s /= 60; 00227 hours = s; 00228 return 0; 00229 }
Here is the caller graph for this function:
int Time::hours | ( | ) | const |
returns the hours
Definition at line 233 of file DataType.cxx.
Referenced by AllDataType::convertToString(), SqlOdbcStatement::execute(), TimeStamp::hours(), Java_csql_jdbc_JSqlStatement_getTime(), parseFrom(), and AllDataType::printVal().
Here is the caller graph for this function:
bool Time::isValid | ( | ) | const |
checks for the validity of the time
Definition at line 248 of file DataType.cxx.
References MAX_VALID_SECONDS.
Referenced by TimeStamp::isValid().
00249 { return timeVal >= 0 && timeVal <= (10000*(MAX_VALID_SECONDS+1)-1); }
Here is the caller graph for this function:
bool Time::isValidTime | ( | int | hours, | |
int | mins, | |||
int | secs | |||
) | [static] |
checks for the validity of the time specified
Definition at line 251 of file DataType.cxx.
Referenced by TimeStamp::parseFrom(), and parseFrom().
00251 { 00252 return (hours >= 0 && hours < 24) && 00253 (mins >= 0 && mins < 60) && 00254 (secs >= 0 && secs < 60); 00255 }
Here is the caller graph for this function:
int Time::minutes | ( | ) | const |
returns the minutes
Definition at line 232 of file DataType.cxx.
Referenced by AllDataType::convertToString(), SqlOdbcStatement::execute(), Java_csql_jdbc_JSqlStatement_getTime(), TimeStamp::minutes(), and AllDataType::printVal().
Here is the caller graph for this function:
int Time::msec | ( | ) | const |
returns the millisecs
Definition at line 234 of file DataType.cxx.
Referenced by TimeStamp::msec().
Here is the caller graph for this function:
Time& Time::operator++ | ( | ) | [inline] |
Time& Time::operator+= | ( | int | seconds | ) | [inline] |
Time& Time::operator-- | ( | ) | [inline] |
Time& Time::operator-= | ( | int | seconds | ) | [inline] |
Definition at line 360 of file DataType.h.
References timeVal.
00360 { timeVal=d2.timeVal; return *this; }
int Time::parseFrom | ( | const char * | s | ) |
parses the time string passed and stores it It should of the format "hh:mm::ss"
Definition at line 280 of file DataType.cxx.
References hours(), isValidTime(), and set().
Referenced by AllDataType::convertToTime(), and TimeStamp::parseTimeFrom().
00280 { 00281 int hours,mins,secs; 00282 int count; 00283 count = sscanf(s,"%d:%d:%d",&hours,&mins,&secs); 00284 if (count < 2) return -1; 00285 if (count == 2) secs = 0; 00286 00287 if (!isValidTime(hours,mins,secs)) 00288 return -1; 00289 return set(hours,mins,secs); 00290 }
Here is the call graph for this function:
Here is the caller graph for this function:
int Time::seconds | ( | ) | const |
returns the secs
Definition at line 231 of file DataType.cxx.
Referenced by AllDataType::convertToString(), SqlOdbcStatement::execute(), Java_csql_jdbc_JSqlStatement_getTime(), AllDataType::printVal(), and TimeStamp::seconds().
Here is the caller graph for this function:
int Time::secondsSinceMidnight | ( | ) | const [inline] |
Definition at line 385 of file DataType.h.
Referenced by TimeStamp::secondsSinceMidnight().
Here is the caller graph for this function:
int Time::set | ( | int | hours, | |
int | mins, | |||
int | secs, | |||
int | usec = 0 | |||
) |
sets the time with specified hours, mins, secs
hours | hours | |
mins | mins | |
secs | secs | |
usec | usec |
Definition at line 210 of file DataType.cxx.
Referenced by copyFromOdbc(), SqlOdbcStatement::fetch(), SqlOdbcStatement::fetchAndPrint(), CacheTableLoader::load(), parseFrom(), TimeStamp::setTime(), and Time().
00210 { 00211 if((hours | mins | secs | usec) < 0) { timeVal = -1; return -1; } 00212 if(hours >= 24 | mins >= 60 | secs >= 62) 00213 { timeVal = -1; return -1; } 00214 timeVal = secs + mins * 60 + hours * 3600; 00215 timeVal *= 10000; 00216 if(usec) timeVal += usec/100; 00217 return 0; 00218 }
Here is the caller graph for this function:
int Time::setMsec | ( | int | ms | ) |
sets the millisecs
Definition at line 237 of file DataType.cxx.
Referenced by TimeStamp::setMsec().
00237 { 00238 if(ms < 0 || ms >= 1000) return -1; 00239 timeVal = timeVal+(10*ms); 00240 return 0; 00241 }
Here is the caller graph for this function:
void Time::setNull | ( | ) | [inline] |
resets the time
Definition at line 383 of file DataType.h.
Referenced by TimeStamp::setNull().
Here is the caller graph for this function:
int Time::setUsec | ( | int | us | ) |
sets the microsecs
Definition at line 242 of file DataType.cxx.
Referenced by TimeStamp::setUsec().
00242 { 00243 if(us < 0 || us >= 1000000) return -1; 00244 timeVal = timeVal +us/100; 00245 return 0; 00246 }
Here is the caller graph for this function:
int Time::usec | ( | ) | const |
returns the microsecs
Definition at line 235 of file DataType.cxx.
Referenced by TimeStamp::usec().
Here is the caller graph for this function: