SourcePro® API Reference Guide

 
List of all members | Public Member Functions | Related Functions
RWTimeTupleOffset Class Reference

Represents a date, time and time zone offset stored as a named tuple of each component. More...

#include <rw/tools/timetupleoffset.h>

Public Member Functions

 RWTimeTupleOffset ()
 
 RWTimeTupleOffset (int year, int mon, int mday, int hour, int min, int sec, rwint64 pico, int gmtoff)
 
 RWTimeTupleOffset (const RWDate &date, int hour=0, int min=0, int sec=0, rwint64 pico=0, int gmtoff=0)
 
 RWTimeTupleOffset (const RWDateTime &dt, const RWZone &zone=RWZone::local())
 
 RWTimeTupleOffset (const RWTimeTuple &tt, int gmtoff=0)
 
 RWTimeTupleOffset (const struct tm *t, rwint64 pico=0, int gmtoff=0)
 
 RWTimeTupleOffset (const RWTimeTupleOffset &other)
 
int dayOfMonth () const
 
void dayOfMonth (int d)
 
void extract (struct tm *tt) const
 
int gmtoff () const
 
void gmtoff (int s)
 
int hour () const
 
void hour (int h)
 
int minute () const
 
void minute (int m)
 
int month () const
 
void month (int m)
 
RWTimeTupleOffsetoperator= (const RWTimeTupleOffset &)
 
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.)

RWvostreamoperator<< (RWvostream &str, const RWTimeTupleOffset &t)
 
RWFileoperator<< (RWFile &file, const RWTimeTupleOffset &t)
 
RWvistreamoperator>> (RWvistream &str, RWTimeTupleOffset &t)
 
RWFileoperator>> (RWFile &file, RWTimeTupleOffset &t)
 
RWvistreamoperator>> (RWvistream &str, RWTimeTupleOffset *&t)
 
RWFileoperator>> (RWFile &file, RWTimeTupleOffset *&t)
 

Detailed Description

RWTimeTupleOffset represents a date, time and time zone offset, stored as a tuple of each calendar component (e.g. year, month, day, hour, minute, second, picosecond, gmtoff).

RWTimeTupleOffset 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.

RWTimeTupleOffset represents a specific instance in time. In cases when time zone information is not required, RWTimeTuple should be used.

See also
RWTimeTupleOffsetFormatter for details on formatting a RWTimeTupleOffset.

Constructor & Destructor Documentation

RWTimeTupleOffset::RWTimeTupleOffset ( )
inline

Default constructor. All fields of the RWTimeTupleOffset instance are set to -1.

RWTimeTupleOffset::RWTimeTupleOffset ( int  year,
int  mon,
int  mday,
int  hour,
int  min,
int  sec,
rwint64  pico,
int  gmtoff 
)
inline

Constructs each field of the RWTimeTupleOffset.

RWTimeTupleOffset::RWTimeTupleOffset ( const RWDate date,
int  hour = 0,
int  min = 0,
int  sec = 0,
rwint64  pico = 0,
int  gmtoff = 0 
)
explicit

Constructs an RWTimeTupleOffset 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 RWTimeTupleOffset are set to -1.

Note
If date has a julian day number greater than 392446299155, the value of the resulting RWTimeTuple is undefined.
RWTimeTupleOffset::RWTimeTupleOffset ( const RWDateTime dt,
const RWZone zone = RWZone::local() 
)
explicit

Constructs an RWTimeTupleOffset based on the date/time information in dt, as interpreted in the time zone zone. If dt is a sentinel value, all fields in RWTimeTupleOffset are set to -1. Otherwise, this function retrieves the date and time components from dt using dt.extract()'.

See also
RWDateTime::extract(struct tm *, const RWZone&)const for limitations on the date-time values supported.
RWTimeTupleOffset::RWTimeTupleOffset ( const RWTimeTuple tt,
int  gmtoff = 0 
)
explicit

Constructs an RWTimeTupleOffset based on the contents of tt and the GMT offset gmtoff.

RWTimeTupleOffset::RWTimeTupleOffset ( const struct tm *  t,
rwint64  pico = 0,
int  gmtoff = 0 
)
inlineexplicit

Constructs an RWTimeTupleOffset based on the date/time information in t and the GMT offset gmtoff.

Note
If t->tm_year > INT_MAX - 1900 or if t->tm_mon > INT_MAX - 1, the results are undefined.
RWTimeTupleOffset::RWTimeTupleOffset ( const RWTimeTupleOffset other)
inline

Copy constructor.

Member Function Documentation

int RWTimeTupleOffset::dayOfMonth ( ) const
inline

Returns the day of the month.

void RWTimeTupleOffset::dayOfMonth ( int  d)
inline

Sets the day of the month to d.

void RWTimeTupleOffset::extract ( struct tm *  tt) const
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 RWTimeTupleOffset. The picoseconds value of the RWTimeTupleOffset is ignored.

Note
If getYear() < INT_MIN + 1900 or if getMonth() < INT_MIN + 1, the results are undefined.
int RWTimeTupleOffset::gmtoff ( ) const
inline

Returns the offset from GMT, in seconds.

void RWTimeTupleOffset::gmtoff ( int  s)
inline

Sets the offset from GMT, in seconds.

int RWTimeTupleOffset::hour ( ) const
inline

Returns the number of hours.

void RWTimeTupleOffset::hour ( int  h)
inline

Sets the number of hours to h.

int RWTimeTupleOffset::minute ( ) const
inline

Returns the number of minutes.

void RWTimeTupleOffset::minute ( int  m)
inline

Sets the number of minutes to m.

int RWTimeTupleOffset::month ( ) const
inline

Returns the month index (0 == January).

void RWTimeTupleOffset::month ( int  m)
inline

Sets the month index to m (0 == January).

RWTimeTupleOffset & RWTimeTupleOffset::operator= ( const RWTimeTupleOffset other)
inline

Assignment operator.

rwint64 RWTimeTupleOffset::picosecond ( ) const
inline

Returns the number of picoseconds.

void RWTimeTupleOffset::picosecond ( rwint64  p)
inline

Sets the number of picoseconds to p.

int RWTimeTupleOffset::second ( ) const
inline

Returns the number of seconds.

void RWTimeTupleOffset::second ( int  s)
inline

Sets the number of seconds to s.

int RWTimeTupleOffset::year ( ) const
inline

Returns the year.

void RWTimeTupleOffset::year ( int  y)
inline

Sets the year to y.

Friends And Related Function Documentation

RWvostream & operator<< ( RWvostream str,
const RWTimeTupleOffset t 
)
related

Saves t to a virtual stream.

RWFile & operator<< ( RWFile file,
const RWTimeTupleOffset t 
)
related

Saves t to an RWFile.

RWvistream & operator>> ( RWvistream str,
RWTimeTupleOffset t 
)
related

Restores t from a virtual stream, replacing the previous contents of t.

RWFile & operator>> ( RWFile file,
RWTimeTupleOffset t 
)
related

Restores t from an RWFile, replacing the previous contents of t.

RWvistream & operator>> ( RWvistream str,
RWTimeTupleOffset *&  t 
)
related

Restores an RWTimeTupleOffset from a virtual stream by allocating an RWTimeTupleOffset on the heap and restoring its state.

RWFile & operator>> ( RWFile file,
RWTimeTupleOffset *&  t 
)
related

Restores an RWTimeTupleOffset from an RWFile by allocating an RWTimeTupleOffset on the heap and restoring its state.

Copyright © 2023 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.