SourcePro® 2023.1 |
SourcePro® API Reference Guide |
Represents a date and time stored as a named tuple of each component. More...
#include <rw/tools/timetuple.h>
Public Member Functions | |
RWTimeTuple () | |
RWTimeTuple (int year, int mon, int mday, int hour, int min, int sec, rwint64 pico) | |
RWTimeTuple (const RWDate &date, int hour=0, int min=0, int sec=0, rwint64 pico=0) | |
RWTimeTuple (const RWDateTime &dt, const RWZone &zone=RWZone::local()) | |
RWTimeTuple (const RWTimeTupleOffset &tt) | |
RWTimeTuple (const struct tm *t, rwint64 pico=0) | |
RWTimeTuple (const RWTimeTuple &other) | |
int | dayOfMonth () const |
void | dayOfMonth (int d) |
void | extract (struct tm *tt) const |
int | hour () const |
void | hour (int h) |
int | minute () const |
void | minute (int m) |
int | month () const |
void | month (int m) |
RWTimeTuple & | operator= (const RWTimeTuple &other) |
rwint64 | picosecond () const |
void | picosecond (rwint64 p) |
int | second () const |
void | second (int s) |
int | year () const |
void | year (int y) |
Related Functions | |
(Note that these are not member functions.) | |
RWvostream & | operator<< (RWvostream &str, const RWTimeTuple &t) |
RWFile & | operator<< (RWFile &file, const RWTimeTuple &t) |
RWvistream & | operator>> (RWvistream &str, RWTimeTuple &t) |
RWFile & | operator>> (RWFile &file, RWTimeTuple &t) |
RWvistream & | operator>> (RWvistream &str, RWTimeTuple *&t) |
RWFile & | operator>> (RWFile &file, RWTimeTuple *&t) |
RWTimeTuple represents a date and time, stored as a tuple of each calendar component (e.g. year, month, day, hour, minute, second, picosecond).
RWTimeTuple may be useful when individual calendar components will be accessed/modified, but where comparisons and calculations on the overall date/time aren't required. In cases where comparisons and calculations are required, see RWDateTime.
RWTimeTuple does not capture an offset from GMT, and instead represents a date/time in local time (similar to struct tm
). In cases where a specific instance in time should be represented, RWTimeTupleOffset should be used.
|
inline |
Default constructor. All fields of the RWTimeTuple instance are set to -1.
|
inline |
Constructs each field of the RWTimeTuple.
|
explicit |
Constructs an RWTimeTuple based on the year, month and day of the month from date and other fields as specified in the parameters. If date is invalid, all fields in RWTimeTuple are set to -1.
|
explicit |
Constructs an RWTimeTuple based on the date/time information in dt, as interpreted in the time zone zone. If dt is a sentinel value, all fields in RWTimeTuple are set to -1. Otherwise, this function retrieves the date and time components from dt using dt.extract()'.
|
explicit |
Constructs an RWTimeTuple based on the contents of tt. The GMT offset of tt is ignored.
|
inlineexplicit |
Constructs an RWTimeTuple based on the date/time information in t.
t->tm_year > INT_MAX - 1900
or if t->tm_mon > INT_MAX - 1
, the results are undefined.
|
inline |
Copy constructor.
|
inline |
Returns the day of the month.
|
inline |
Sets the day of the month to d.
|
inline |
Populates the struct tm
tt based on the values in self. The fields tm_wday
, tm_yday
and tm_isdst
are set to -1 as that information is not known in RWTimeTuple. The picoseconds value of the RWTimeTuple is ignored.
getYear() < INT_MIN + 1900
or if getMonth() < INT_MIN + 1
, the results are undefined.
|
inline |
Returns the number of hours.
|
inline |
Sets the number of hours to h.
|
inline |
Returns the number of minutes.
|
inline |
Sets the number of minutes to m.
|
inline |
Returns the month index (0 == January).
|
inline |
Sets the month index to m (0 == January).
|
inline |
Assignment operator.
|
inline |
Returns the number of picoseconds.
|
inline |
Sets the number of picoseconds to p.
|
inline |
Returns the number of seconds.
|
inline |
Sets the number of seconds to s.
|
inline |
Returns the year.
|
inline |
Sets the year to y.
|
related |
Saves t to a virtual stream.
|
related |
Saves t to an RWFile.
|
related |
Restores t from a virtual stream, replacing the previous contents of t.
|
related |
Restores t from an RWFile, replacing the previous contents of t.
|
related |
Restores an RWTimeTuple from a virtual stream by allocating an RWDateTime on the heap and restoring its state.
|
related |
Restores an RWTimeTuple from an RWFile by allocating an RWTimeTuple on the heap and restoring its state.
Copyright © 2023 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved. |