OWLNext 7.0
Borland's Object Windows Library for the modern age
|
The TTime class encapsulates time functions and characteristics. More...
#include <owl/time.h>
Public Member Functions | |
friend | TDate::TDate (const TTime &) |
TTime () | |
Construct TTime with current time (seconds since Jan 1, 1901). | |
TTime (const TSystemTime &t) | |
from SYSTEMTIME | |
TTime (const TFileTime &t) | |
from FILETIME | |
TTime (ClockTy s) | |
Constructs a TTime object with the given s (seconds since January 1, 1901). | |
TTime (HourTy h, MinuteTy m, SecondTy s=0) | |
Specified time and today's date: | |
TTime (const TDate &, HourTy h=0, MinuteTy m=0, SecondTy s=0) | |
Construct a Time for the specified (local) Date, hour, minute, and second. | |
TSystemTime | GetSystemTime () const |
TFileTime | GetFileTime () const |
tstring | AsString () const |
Returns a string object containing the time. | |
int | CompareTo (const TTime &) const |
Compares t to this TTime object and returns 0 if the times are equal, 1 if t is earlier, and -1 if t is later. | |
unsigned | Hash () const |
Hash function: Returns seconds since January 1, 1901. | |
HourTy | Hour () const |
Returns the hour in local time. | |
HourTy | HourGMT () const |
Returns the hour in Greenwich mean time. | |
int | IsDST () const |
Returns 1 if the time is in daylight saving time; 0 otherwise. | |
int | IsValid () const |
Returns 1 if this TTime object contains a valid time, 0 otherwise. | |
TTime | Max (const TTime &t) const |
Returns either this TTime object or t, whichever is greater. | |
TTime | Min (const TTime &t) const |
Returns either this TTime object or t, whichever is less. | |
MinuteTy | Minute () const |
Returns the minute in local time. | |
MinuteTy | MinuteGMT () const |
Returns the minute in Greenwich Mean Time. | |
SecondTy | Second () const |
Returns seconds. | |
ClockTy | Seconds () const |
Returns seconds since January 1, 1901. | |
int | operator< (const TTime &t) const |
Returns 1 if the target time is less than time t, 0 otherwise. | |
int | operator<= (const TTime &t) const |
Returns 1 if the target time is less than or equal to time t, 0 otherwise. | |
int | operator> (const TTime &t) const |
Returns 1 if the target time is greater than time t, 0 otherwise. | |
int | operator>= (const TTime &t) const |
Returns 1 if the target time is greater than or equal to time t, 0 otherwise. | |
int | operator== (const TTime &t) const |
Returns 1 if the target time is equal to time t, 0 otherwise. | |
int | operator!= (const TTime &t) const |
Returns 1 if the target time is not equal to time t, 0 otherwise. | |
int | Between (const TTime &a, const TTime &b) const |
Returns 1 if the target date is between TTime a and TTime b, 0 otherwise. | |
void | operator++ () |
Increments the time by 1 second. | |
void | operator-- () |
Decrements the time by 1 second. | |
void | operator+= (long s) |
Adds s seconds to the time. | |
void | operator-= (long s) |
Subtracts s seconds from the time. | |
Static Public Member Functions | |
static TTime | BeginDST (unsigned year) |
Return the time at which DST starts for the given year. | |
static TTime | EndDST (unsigned year) |
Return the time at which DST ends for the given year. | |
static int | PrintDate (int) |
Set flag to 1 to print the date along with the time; set to 0 to not print the date. | |
Static Protected Member Functions | |
static int | AssertDate (const TDate &) |
Returns 1 if d is between the earliest valid date (RefDate) and the latest valid date (MaxDate). | |
Static Protected Attributes | |
static const TDate | RefDate |
The minimum valid date for TTime objects: January 1, 1901. | |
static const TDate | MaxDate |
The maximum valid date for TTime objects. | |
Friends | |
tostream & | operator<< (tostream &, const TTime &) |
Inserts time t into output stream os. | |
opstream & | operator<< (opstream &s, const TTime &d) |
ipstream & | operator>> (ipstream &s, TTime &d) |
TTime | operator+ (const TTime &t, long s) |
Adds s seconds to time t. | |
TTime | operator+ (long s, const TTime &t) |
Adds s seconds to time t. | |
TTime | operator- (const TTime &t, long s) |
Performs subtraction, in seconds, between s and t. | |
TTime | operator- (long s, const TTime &t) |
Performs subtraction, in seconds, between s and t. | |
The TTime class encapsulates time functions and characteristics.
owl::TTime::TTime | ( | ) |
Construct TTime with current time (seconds since Jan 1, 1901).
Definition at line 137 of file time.cpp.
References TTime(), owl::TSystemTime::LocalTime(), and TDate::TDate().
owl::TTime::TTime | ( | const TSystemTime & | t | ) |
from SYSTEMTIME
Definition at line 209 of file time.cpp.
References TTime(), owl::TSystemTime::GetHour(), owl::TSystemTime::GetMinute(), owl::TSystemTime::GetSecond(), and TDate::TDate().
owl::TTime::TTime | ( | const TFileTime & | t | ) |
from FILETIME
Definition at line 228 of file time.cpp.
References TTime(), owl::TSystemTime::GetHour(), owl::TSystemTime::GetMinute(), owl::TSystemTime::GetSecond(), and TDate::TDate().
|
inline |
Specified time and today's date:
Definition at line 166 of file time.cpp.
References TTime(), and TDate::TDate().
Construct a Time for the specified (local) Date, hour, minute, and second.
Checking for these situations necessitates a lot of jumping back and forth by an hour to check for the boundary.
Definition at line 182 of file time.cpp.
References IsDST(), owl::TDate::IsValid(), RefDate, and owl::SECONDS_IN_DAY.
Returns 1 if d is between the earliest valid date (RefDate) and the latest valid date (MaxDate).
Definition at line 62 of file time.cpp.
References owl::TDate::Between(), MaxDate, and RefDate.
tstring owl::TTime::AsString | ( | ) | const |
Returns a string object containing the time.
Definition at line 29 of file timeio.cpp.
Return the time at which DST starts for the given year.
Note that the time returned is the time at which DST starts locally, but it is returned in GMT.
Definition at line 100 of file time.cpp.
References TDate::TDate().
TFileTime owl::TTime::GetFileTime | ( | ) | const |
Definition at line 238 of file time.cpp.
References GetSystemTime().
TSystemTime owl::TTime::GetSystemTime | ( | ) | const |
unsigned owl::TTime::Hash | ( | ) | const |
HourTy owl::TTime::Hour | ( | ) | const |
Returns the hour in local time.
Definition at line 266 of file time.cpp.
References owl::SECONDS_IN_DAY.
HourTy owl::TTime::HourGMT | ( | ) | const |
Returns the hour in Greenwich mean time.
Definition at line 274 of file time.cpp.
References owl::SECONDS_IN_DAY.
int owl::TTime::IsDST | ( | ) | const |
Returns 1 if the time is in daylight saving time; 0 otherwise.
Definition at line 282 of file time.cpp.
References BeginDST(), EndDST(), owl::SECONDS_IN_DAY, and TDate::TDate().
|
inline |
MinuteTy owl::TTime::Minute | ( | ) | const |
Returns the minute in local time.
Definition at line 316 of file time.cpp.
References owl::SECONDS_IN_DAY.
MinuteTy owl::TTime::MinuteGMT | ( | ) | const |
Returns the minute in Greenwich Mean Time.
Definition at line 324 of file time.cpp.
References owl::SECONDS_IN_DAY.
|
inline |
|
inline |
Set flag to 1 to print the date along with the time; set to 0 to not print the date.
Returns the old setting.
Definition at line 69 of file timeio.cpp.
SecondTy owl::TTime::Second | ( | ) | const |
|
inline |
owl::TTime::TDate::TDate | ( | const TTime & | ) |
Inserts time t into output stream os.
Definition at line 41 of file timeio.cpp.
|
staticprotected |
|
staticprotected |