BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bdlt::DateTz Class Reference

#include <bdlt_datetz.h>

Public Member Functions

 DateTz ()
 Create a DateTz object having the (default) attribute values.
 
 DateTz (const Date &localDate, int offset)
 
 DateTz (const DateTz &original)
 
 ~DateTz ()
 Destroy this object.
 
DateTzoperator= (const DateTz &rhs)
 
void setDateTz (const Date &localDate, int offset)
 
int setDateTzIfValid (const Date &localDate, int offset)
 
template<class STREAM >
STREAM & bdexStreamIn (STREAM &stream, int version)
 
Date localDate () const
 
int offset () const
 
Datetime utcStartTime () const
 
template<class STREAM >
STREAM & bdexStreamOut (STREAM &stream, int version) const
 
bsl::ostream & print (bsl::ostream &stream, int level=0, int spacesPerLevel=4) const
 
Datetime gmtStartTime () const
 
int validateAndSetDateTz (const Date &localDate, int offset)
 

Static Public Member Functions

static bool isValid (const Date &localDate, int offset)
 
static int maxSupportedBdexVersion (int versionSelector)
 
static int maxSupportedBdexVersion ()
 

Detailed Description

This value-semantic class describes a date value in a particular time zone, which is indicated using an offset from UTC (in minutes).

See bdlt_datetz

Constructor & Destructor Documentation

◆ DateTz() [1/3]

bdlt::DateTz::DateTz ( )
inline

◆ DateTz() [2/3]

bdlt::DateTz::DateTz ( const Date localDate,
int  offset 
)
inline

Create a DateTz object having a local date value equal to the specified localDate and a time zone offset value from UTC equal to the specified offset (in minutes). The behavior is undefined unless offset is in the range ( -1440 .. 1440 ). Note that this method provides no validation, and it is the user's responsibility to ensure that offset represents a valid time zone and that localDate represents a valid date in that time zone.

◆ DateTz() [3/3]

bdlt::DateTz::DateTz ( const DateTz original)
inline

Create a DateTz object having the same value as the specified original object.

◆ ~DateTz()

bdlt::DateTz::~DateTz ( )
inline

Member Function Documentation

◆ bdexStreamIn()

template<class STREAM >
STREAM & bdlt::DateTz::bdexStreamIn ( STREAM &  stream,
int  version 
)

Assign to this object the value read from the specified input stream using the specified version format, and return a reference to stream. If stream is initially invalid, this operation has no effect. If version is not supported, this object is unaltered and stream is invalidated, but otherwise unmodified. If version is supported but stream becomes invalid during this operation, this object has an undefined, but valid, state. Note that no version is read from stream. See the bslx package-level documentation for more information on BDEX streaming of value-semantic types and containers.

◆ bdexStreamOut()

template<class STREAM >
STREAM & bdlt::DateTz::bdexStreamOut ( STREAM &  stream,
int  version 
) const

Write the value of this object, using the specified version format, to the specified output stream, and return a reference to stream. If stream is initially invalid, this operation has no effect. If version is not supported, stream is invalidated, but otherwise unmodified. Note that version is not written to stream. See the bslx package-level documentation for more information on BDEX streaming of value-semantic types and containers.

◆ gmtStartTime()

Datetime bdlt::DateTz::gmtStartTime ( ) const
inline
Deprecated:
replaced by utcStartTime.

Return a Datetime object having the value of the UTC "point in time" when the local date starts (i.e., 0000 hours local time). The behavior is undefined unless the local date starting time represents a valid Datetime value for the UTC timezone. Note that the returned value is equal to:

int offset() const
Definition bdlt_datetz.h:498
Date localDate() const
Definition bdlt_datetz.h:492
Definition bdlt_datetime.h:331
Datetime & addMinutes(bsls::Types::Int64 minutes)
Definition bdlt_datetime.h:1992

◆ isValid()

bool bdlt::DateTz::isValid ( const Date localDate,
int  offset 
)
inlinestatic

Return true if the specified localDate and the specified time zone offset represent a valid DateTz value, and false otherwise. A localDate and offset represent a valid DateTz value if offset is in the range ( -1440 .. 1440 ). Note that a true result from this function does not guarantee that offset corresponds to any geographical or historical time zone. Also note that a true result from this function does not guarantee that localDate itself is a valid Date object.

◆ localDate()

Date bdlt::DateTz::localDate ( ) const
inline

Return a Date object having the value of the local date represented by this object. Note that this is the Date supplied at construction and may not correspond to the actual time zone offset of the local system.

◆ maxSupportedBdexVersion() [1/2]

int bdlt::DateTz::maxSupportedBdexVersion ( )
inlinestatic
Deprecated:
Use maxSupportedBdexVersion(int) instead.

Return the most current BDEX streaming version number supported by this class.

◆ maxSupportedBdexVersion() [2/2]

int bdlt::DateTz::maxSupportedBdexVersion ( int  versionSelector)
inlinestatic

Return the maximum valid BDEX format version, as indicated by the specified versionSelector, to be passed to the bdexStreamOut method. Note that it is highly recommended that versionSelector be formatted as "YYYYMMDD", a date representation. Also note that versionSelector should be a compile-time-chosen value that selects a format version supported by both externalizer and unexternalizer. See the bslx package-level documentation for more information on BDEX streaming of value-semantic types and containers.

◆ offset()

int bdlt::DateTz::offset ( ) const
inline

Return the time zone offset of this DateTz object. Note that the offset is in minutes from UTC.

◆ operator=()

DateTz & bdlt::DateTz::operator= ( const DateTz rhs)
inline

Assign to this object the value of the specified rhs object, and return a reference providing modifiable access to this object.

◆ print()

bsl::ostream & bdlt::DateTz::print ( bsl::ostream &  stream,
int  level = 0,
int  spacesPerLevel = 4 
) const

Write the value of this object to the specified output stream in a human-readable format, and return a reference to stream. Optionally specify an initial indentation level, whose absolute value is incremented recursively for nested objects. If level is specified, optionally specify spacesPerLevel, whose absolute value indicates the number of spaces per indentation level for this and all of its nested objects. If level is negative, suppress indentation of the first line. If spacesPerLevel is negative, format the entire output on one line, suppressing all but the initial indentation (as governed by level). If stream is not valid on entry, this operation has no effect. Note that the format is not fully specified, and can change without notice.

◆ setDateTz()

void bdlt::DateTz::setDateTz ( const Date localDate,
int  offset 
)
inline

Set the local date and the time zone offset of this object to the specified localDate and offset values respectively. The behavior is undefined unless offset is in the range ( -1440 .. 1440 ). Note that this method provides no validation, and it is the user's responsibility to assure the consistency of the resulting value.

◆ setDateTzIfValid()

int bdlt::DateTz::setDateTzIfValid ( const Date localDate,
int  offset 
)
inline

Set the local date and time zone offset of this object to the specified localDate and offset values respectively if localDate and offset represent a valid DateTz value. Return 0 on success, and a non-zero value with no effect on this DateTz object otherwise.

◆ utcStartTime()

Datetime bdlt::DateTz::utcStartTime ( ) const
inline

Return a Datetime object having the value of the UTC "point in time" when the local date starts (i.e., 0000 hours local time). The behavior is undefined unless the local date starting time represents a valid Datetime value for the UTC timezone. Note that the returned value is equal to:

◆ validateAndSetDateTz()

int bdlt::DateTz::validateAndSetDateTz ( const Date localDate,
int  offset 
)
inline

Set the local date and time zone offset of this object to the specified localDate and offset values respectively if localDate and offset represent a valid DateTz value. Return 0 on success, and a non-zero value with no effect on this DateTz object otherwise.


The documentation for this class was generated from the following file: