[#BloombergLP-bdlt-TimeTz]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlt.adoc[bdlt]::TimeTz
:relfileprefix: ../../
:mrdocs:

This value&hyphen;semantic class describes a time value in a particular time zone, which is indicated using an offset from UTC (in minutes)&period; The offset is available via the `offset` method, and is defined by the relationship&colon; `localTime() &hyphen; offset() &equals;&equals; utcTime`&period; The time and offset values are logically assumed to correspond to geographically valid values, however, this constraint is not enforced&period;

== Synopsis

Declared in `&lt;bdlt&lowbar;timetz&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
class TimeTz;
----

== Description

This class&colon; &ast; supports a complete set of _value&hyphen;semantic_ operations &ast; supports BDEX streaming For terminology see `bsldoc&lowbar;glossary`&period;

== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bdlt/TimeTz/2constructor-02.adoc[`TimeTz`]         [.small]#[constructor]#
| Constructors
| xref:BloombergLP/bdlt/TimeTz/2destructor.adoc[`&#126;TimeTz`] [.small]#[destructor]#
| Destroy this object&period;
| xref:BloombergLP/bdlt/TimeTz/operator_assign.adoc[`operator&equals;`] 
| Assign to this object the value of the specified `rhs` object, and return a reference providing modifiable access to this object&period;
| xref:BloombergLP/bdlt/TimeTz/bdexStreamIn.adoc[`bdexStreamIn`] 
| Assign to this object the value read from the specified input `stream` using the specified `version` format, and return a reference to `stream`&period; If `stream` is initially invalid, this operation has no effect&period; If `version` is not supported, this object is unaltered and `stream` is invalidated, but otherwise unmodified&period; If `version` is supported but `stream` becomes invalid during this operation, this object has an undefined, but valid, state&period; Note that no version is read from `stream`&period; See the `bslx` package&hyphen;level documentation for more information on BDEX streaming of value&hyphen;semantic types and containers&period;
| xref:BloombergLP/bdlt/TimeTz/bdexStreamOut.adoc[`bdexStreamOut`] 
| Write the value of this object, using the specified `version` format, to the specified output `stream`, and return a reference to `stream`&period; If `stream` is initially invalid, this operation has no effect&period; If `version` is not supported, `stream` is invalidated, but otherwise unmodified&period; Note that `version` is not written to `stream`&period; See the `bslx` package&hyphen;level documentation for more information on BDEX streaming of value&hyphen;semantic types and containers&period;
| xref:BloombergLP/bdlt/TimeTz/gmtTime.adoc[`gmtTime`] 
| Return a `Time` object having the value of the UTC time represented by this object&period; Note that the returned value is equal to `localTime() &hyphen; offset()` minutes&period;
| xref:BloombergLP/bdlt/TimeTz/localTime.adoc[`localTime`] 
| Return a `Time` object having the value of the local time attribute of this object&period; Note that the `Time` value returned is the value stored in this object, and may be different from the local time of the system&period;
| xref:BloombergLP/bdlt/TimeTz/offset.adoc[`offset`] 
| Return the time zone offset of this object in minutes from UTC&period;
| xref:BloombergLP/bdlt/TimeTz/print.adoc[`print`] 
| Write the value of this object to the specified output `stream` in a human&hyphen;readable format, and return a reference to `stream`&period; Optionally specify an initial indentation `level`, whose absolute value is incremented recursively for nested objects&period; 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&period; If `level` is negative, suppress indentation of the first line&period; If `spacesPerLevel` is negative, format the entire output on one line, suppressing all but the initial indentation (as governed by `level`)&period; If `stream` is not valid on entry, this operation has no effect&period; Note that the format is not fully specified, and can change without notice&period;
| xref:BloombergLP/bdlt/TimeTz/setTimeTz.adoc[`setTimeTz`] 
| Set the local time and time zone offset attributes of this object to the specified `localTime` and `offset` values respectively&period; The behavior is undefined unless `offset` is in the range `( &hyphen;1440 &period;&period; 1440 )`&period; Note that this method provides no validation, and it is the user&apos;s responsibility to assure the consistency of the resulting value&period;
| xref:BloombergLP/bdlt/TimeTz/setTimeTzIfValid.adoc[`setTimeTzIfValid`] 
| Set the local time and the time zone offset of this object to the specified `localTime` and `offset` values respectively if `localTime` and `offset` represent a valid `TimeTz` value, and leave the object unmodified otherwise&period; Return 0 on success, and a non&hyphen;zero value otherwise&period;
| xref:BloombergLP/bdlt/TimeTz/utcTime.adoc[`utcTime`] 
| Return a `Time` object having the value of the UTC time represented by this object&period; Note that the returned value is equal to `localTime() &hyphen; offset()` minutes&period;
| xref:BloombergLP/bdlt/TimeTz/validateAndSetTimeTz.adoc[`validateAndSetTimeTz`] 
| Set the local time and the time zone offset of this object to the specified `localTime` and `offset` values respectively if `localTime` and `offset` represent a valid `TimeTz` value&period; Return 0 on success, and a non&hyphen;zero value with no effect on this object otherwise&period;
|===


== Static Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bdlt/TimeTz/isValid.adoc[`isValid`] 
| Return `true` if the specified `localTime` and the specified time zone `offset` represent a valid `TimeTz` value, and `false` otherwise&period; A `localTime` and `offset` represent a valid `TimeTz` value if `offset` is in the range `( &hyphen;1440 &period;&period; 1440 )`, and `offset` is 0 if `localTime` has the value `24&colon;00&colon;00&period;000`&period; Note that a `true` result from this function does not guarantee that `offset` corresponds to any geographical or historical time zone&period; Also note that a `true` result from this function does not guarantee that `localTime` itself is a valid `Time` object&period;
| xref:BloombergLP/bdlt/TimeTz/maxSupportedBdexVersion-043.adoc[`maxSupportedBdexVersion`] 
| `maxSupportedBdexVersion` overloads
|===


== Non-Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bdlt/operator_not_eq-0c6.adoc[`operator!&equals;`]
| Return `true` if the specified `lhs` and `rhs` objects do not have the same value, and `false` otherwise&period; Two `TimeTz` objects do not have the same value if any of their corresponding `localTime` and `offset` attributes have different values&period;
| xref:BloombergLP/bdlt/operator_eq-0ac.adoc[`operator&equals;&equals;`]
| Return `true` if the specified `lhs` and `rhs` objects have the same value, and `false` otherwise&period; Two `TimeTz` objects have the same value if their corresponding `localTime` and `offset` attributes have the same values&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
