====== IBPP:Time ====== The IBPP::Time class represents a time value. It is not an interface class, with automatic smart pointer management like for instance the [[Database]] class. It is a plain classical C++ class. Use it to interact easily with TIME (SQL) columns in your databases. ===== Definition ===== See the file ibpp.h for an up-to-date definition. A Time is internally made of a simple integer, representing the ten-thousands of seconds elapsed since midnight (00h00m00s0000). Being made only of an integer as its data part, the class Time is a light object which you can use without fear of bulky data structures. ===== Methods ===== ==== void Clear() ==== Resets the time to midnight (0). ==== void Now() ==== Sets the time to 'now' (local time). ==== void SetTime(int hour, int minute, int second, int tenthousandths = 0) ==== Sets the time according to the individual components. The ten-thousandths of second are optional and default to 0 for ease of use. ==== SetTime(int tm) ==== Sets the time based on an integer value, as the one internally stored in the time object itself. See the int GetTime() method too. ==== void GetTime(int& hour, int& minute, int& second) ==== Gets a time in its basic components hours, minutes, seconds. ==== void GetTime(int& hour, int& minute, int& second, int&tenthousandths) ==== Gets a time in its basic components hours, minutes, seconds and ten-thousandths of a second. ==== int GetTime() ==== Returns the internal integer representing the time value. Usefull for some time arithmetic. ==== int Hours(), int Minutes(), int Seconds(), int SubSeconds() ==== Return the hour, minute, second, subsecond value of the Time. Subseconds are actually ten-thousandths of seconds. ===== Constructors ===== ==== Time() ==== The default constructructor builds an empty time (midnight), same as if Clear() was called on an existing time. ==== Time(int tm) ==== Similarly to the SetTime(int) method, this form of the constructor builds a time out of the internal representation of another one. ==== Time(int hour, int minute, int second, int tenthousandths = 0) ==== Similarly to the SetTime(int, int, int, int = 0) method, this form of the constructor builds a time our of its basic components (hour, minute, second and optionally ten-thousandths of a second). ==== Time(const Time&) ==== Ordinary copy constructor. To make the Time a good citizen of your code. ===== Operators ===== ==== Time& operator=(const Time&) ==== To assign a time from another one. ==== Time& operator=(const Timestamp&) ==== To assign a time from the time portion of a [[Timestamp]] object. ==== bool operator==(const Time&) ==== To compare two Times for equality. ==== bool operator<(const Time&) ==== To compare if one Time is strictly 'lower' (the time is before) the other. ===== See also ===== These classes are closely related to this one : * [[Date]] * [[Timestamp]]