SourcePro® API Reference Guide

 
Loading...
Searching...
No Matches
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 (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 RWTimeTupleOffset &other)
 
 RWTimeTupleOffset (const struct tm *t, rwint64 pico=0, int gmtoff=0)
 
 RWTimeTupleOffset (int year, int mon, int mday, int hour, int min, int sec, rwint64 pico, int gmtoff)
 
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)
 

Friends

struct RWTHash< RWTimeTupleOffset >
 

Related Symbols

(Note that these are not member symbols.)

RWFileoperator<< (RWFile &file, const RWTimeTupleOffset &t)
 
RWvostreamoperator<< (RWvostream &str, const RWTimeTupleOffset &t)
 
RWFileoperator>> (RWFile &file, RWTimeTupleOffset &t)
 
RWFileoperator>> (RWFile &file, RWTimeTupleOffset *&t)
 
RWvistreamoperator>> (RWvistream &str, RWTimeTupleOffset &t)
 
RWvistreamoperator>> (RWvistream &str, 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() [1/7]

RWTimeTupleOffset::RWTimeTupleOffset ( )
inline

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

◆ RWTimeTupleOffset() [2/7]

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() [3/7]

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() [4/7]

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() [5/7]

RWTimeTupleOffset::RWTimeTupleOffset ( const RWTimeTuple & tt,
int gmtoff = 0 )
explicit

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

◆ RWTimeTupleOffset() [6/7]

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() [7/7]

RWTimeTupleOffset::RWTimeTupleOffset ( const RWTimeTupleOffset & other)
inline

Copy constructor.

Member Function Documentation

◆ dayOfMonth() [1/2]

int RWTimeTupleOffset::dayOfMonth ( ) const
inline

Returns the day of the month.

◆ dayOfMonth() [2/2]

void RWTimeTupleOffset::dayOfMonth ( int d)
inline

Sets the day of the month to d.

◆ extract()

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.

◆ gmtoff() [1/2]

int RWTimeTupleOffset::gmtoff ( ) const
inline

Returns the offset from GMT, in seconds.

◆ gmtoff() [2/2]

void RWTimeTupleOffset::gmtoff ( int s)
inline

Sets the offset from GMT, in seconds.

◆ hour() [1/2]

int RWTimeTupleOffset::hour ( ) const
inline

Returns the number of hours.

◆ hour() [2/2]

void RWTimeTupleOffset::hour ( int h)
inline

Sets the number of hours to h.

◆ minute() [1/2]

int RWTimeTupleOffset::minute ( ) const
inline

Returns the number of minutes.

◆ minute() [2/2]

void RWTimeTupleOffset::minute ( int m)
inline

Sets the number of minutes to m.

◆ month() [1/2]

int RWTimeTupleOffset::month ( ) const
inline

Returns the month index (0 == January).

◆ month() [2/2]

void RWTimeTupleOffset::month ( int m)
inline

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

◆ operator=()

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

Assignment operator.

◆ picosecond() [1/2]

rwint64 RWTimeTupleOffset::picosecond ( ) const
inline

Returns the number of picoseconds.

◆ picosecond() [2/2]

void RWTimeTupleOffset::picosecond ( rwint64 p)
inline

Sets the number of picoseconds to p.

◆ second() [1/2]

int RWTimeTupleOffset::second ( ) const
inline

Returns the number of seconds.

◆ second() [2/2]

void RWTimeTupleOffset::second ( int s)
inline

Sets the number of seconds to s.

◆ year() [1/2]

int RWTimeTupleOffset::year ( ) const
inline

Returns the year.

◆ year() [2/2]

void RWTimeTupleOffset::year ( int y)
inline

Sets the year to y.

Friends And Related Symbol Documentation

◆ operator<<() [1/2]

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

Saves t to an RWFile.

◆ operator<<() [2/2]

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

Saves t to a virtual stream.

◆ operator>>() [1/4]

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

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

◆ operator>>() [2/4]

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

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

◆ operator>>() [3/4]

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

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

◆ operator>>() [4/4]

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.

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