8#ifndef INCLUDED_BDLT_TIME
9#define INCLUDED_BDLT_TIME
148#include <bdlscm_version.h>
169#include <bsl_iosfwd.h>
170#include <bsl_cstring.h>
171#include <bsl_sstream.h>
200 k_DEFAULT_FRACTIONAL_SECOND_PRECISION = 6
219 template <
class HASHALG>
371 int milliseconds = 0,
465 template <
class STREAM>
514 int fractionalSecondPrecision = 6)
const;
526 template <
class STREAM>
542 bsl::ostream&
print(bsl::ostream& stream,
544 int spacesPerLevel = 4)
const;
546#ifndef BDE_OPENSOURCE_PUBLICATION
557#ifndef BDE_OMIT_INTERNAL_DEPRECATED
569 bsl::ostream&
streamOut(bsl::ostream& stream)
const;
592template <
class HASHALG>
674 d_value = totalMicroseconds | k_REP_MASK;
683 return invalidMicrosecondsFromMidnight();
686 return d_value & (~k_REP_MASK);
692 return microsecondsFromMidnight() | k_REP_MASK;
722 if (versionSelector >= 20170401) {
736Time::Time(
int hour,
int minute,
int second,
int millisecond,
int microsecond)
749: d_value(original.d_value)
751 d_value = updatedRepresentation();
758 d_value = rhs.d_value;
759 d_value = updatedRepresentation();
781 enum { k_SUCCESS = 0, k_FAILURE = -1 };
793 enum { k_SUCCESS = 0, k_FAILURE = -1 };
805 enum { k_SUCCESS = 0, k_FAILURE = -1 };
817 enum { k_SUCCESS = 0, k_FAILURE = -1 };
829 enum { k_SUCCESS = 0, k_FAILURE = -1 };
845 enum { k_SUCCESS = 0, k_FAILURE = -1 };
857template <
class STREAM>
864 stream.getInt64(tmp);
869 setMicrosecondsFromMidnight(tmp);
877 stream.getInt32(tmp);
880 &&
static_cast<unsigned int>(tmp) <=
900 return static_cast<int>(microsecondsFromMidnight()
907 return static_cast<int>( microsecondsFromMidnight()
914 return static_cast<int>( microsecondsFromMidnight()
922 return static_cast<int>( microsecondsFromMidnight()
930 return static_cast<int>( microsecondsFromMidnight()
937template <
class STREAM>
943 stream.putInt64(microsecondsFromMidnight());
946 stream.putInt32(
static_cast<int>(microsecondsFromMidnight()
957#ifndef BDE_OPENSOURCE_PUBLICATION
967#ifndef BDE_OMIT_INTERNAL_DEPRECATED
977 return stream << *
this;
995 return result += rhs;
1002 return result += lhs;
1009 return result -= rhs;
1015 DatetimeInterval timeInterval;
1017 timeInterval.setTotalMicroseconds(
1021 return timeInterval;
1030 return lhsValue == rhsValue;
1039 return lhsValue != rhsValue;
1046 != lhs.microsecondsFromMidnight());
1048 != rhs.microsecondsFromMidnight());
1053 return lhsValue < rhsValue;
1060 != lhs.microsecondsFromMidnight());
1062 != rhs.microsecondsFromMidnight());
1067 return lhsValue <= rhsValue;
1074 != lhs.microsecondsFromMidnight());
1076 != rhs.microsecondsFromMidnight());
1081 return lhsValue > rhsValue;
1088 != lhs.microsecondsFromMidnight());
1090 != rhs.microsecondsFromMidnight());
1095 return lhsValue >= rhsValue;
1101 return time.print(stream, 0, -1);
1105template <
class HASHALG>
1109 using ::BloombergLP::bslh::hashAppend;
1110 hashAppend(hashAlg,
object.microsecondsFromMidnight());
Definition bdlt_datetimeinterval.h:201
Definition bdlt_time.h:196
static int maxSupportedBdexVersion()
Definition bdlt_time.h:961
friend bool operator!=(const Time &, const Time &)
int setMicrosecondIfValid(int microsecond)
Definition bdlt_time.h:791
void getTime(int *hour, int *minute=0, int *second=0, int *millisecond=0, int *microsecond=0) const
bsl::ostream & streamOut(bsl::ostream &stream) const
Definition bdlt_time.h:975
friend bool operator<=(const Time &, const Time &)
void setSecond(int second)
void setTime(int hour, int minute=0, int second=0, int millisecond=0, int microsecond=0)
STREAM & bdexStreamIn(STREAM &stream, int version)
Definition bdlt_time.h:858
int setTimeIfValid(int hour, int minute=0, int second=0, int millisecond=0, int microsecond=0)
Definition bdlt_time.h:839
int addInterval(const DatetimeInterval &interval)
void setMinute(int minute)
int addSeconds(int seconds)
Time & operator=(const Time &rhs)
Definition bdlt_time.h:756
int microsecond() const
Return the value of the microsecond attribute of this time object.
Definition bdlt_time.h:905
friend bool operator>=(const Time &, const Time &)
static int maxSupportedVersion()
Definition bdlt_time.h:969
int setMillisecondIfValid(int millisecond)
Definition bdlt_time.h:803
int addMinutes(int minutes)
int setMinuteIfValid(int minute)
Definition bdlt_time.h:815
static bool isValid(int hour, int minute=0, int second=0, int millisecond=0, int microsecond=0)
Definition bdlt_time.h:697
bsl::ostream & print(bsl::ostream &stream, int level=0, int spacesPerLevel=4) const
int second() const
Return the value of the second attribute of this time object.
Definition bdlt_time.h:928
void setMillisecond(int millisecond)
Time & operator+=(const DatetimeInterval &rhs)
Definition bdlt_time.h:765
int validateAndSetTime(int hour, int minute=0, int second=0, int millisecond=0)
Definition bdlt_time.h:981
Time()
Create a Time object having the value 24:00:00.000000.
Definition bdlt_time.h:730
int addMicroseconds(bsls::Types::Int64 microseconds)
friend void hashAppend(HASHALG &hashAlg, const Time &)
int addTime(int hours, int minutes=0, int seconds=0, int milliseconds=0, bsls::Types::Int64 microseconds=0)
int printToBuffer(char *result, int numBytes, int fractionalSecondPrecision=6) const
int millisecond() const
Return the value of the millisecond attribute of this time object.
Definition bdlt_time.h:912
int addMilliseconds(int milliseconds)
int setSecondIfValid(int second)
Definition bdlt_time.h:827
Time & operator-=(const DatetimeInterval &rhs)
Definition bdlt_time.h:772
void setMicrosecond(int microsecond)
~Time()=default
Destroy this 'Time' object.
friend bool operator<(const Time &, const Time &)
STREAM & bdexStreamOut(STREAM &stream, int version) const
Definition bdlt_time.h:938
int minute() const
Return the value of the minute attribute of this time object.
Definition bdlt_time.h:920
int setHourIfValid(int hour)
Definition bdlt_time.h:779
friend bool operator==(const Time &, const Time &)
friend bool operator>(const Time &, const Time &)
int hour() const
Return the value of the hour attribute of this time object.
Definition bdlt_time.h:898
friend DatetimeInterval operator-(const Time &, const Time &)
Definition bsls_atomic.h:892
#define BSLS_ASSERT_SAFE(X)
Definition bsls_assert.h:1762
#define BSLS_IDENT(str)
Definition bsls_ident.h:195
#define BSLS_REVIEW(X)
Definition bsls_review.h:949
void hashAppend(HASH_ALGORITHM &hashAlg, const baljsn::EncoderTestAddress &object)
Definition baljsn_encoder_testtypes.h:9236
Definition bbldc_basicisma30360.h:112
bool operator>(const Date &lhs, const Date &rhs)
bool operator<(const Date &lhs, const Date &rhs)
bool operator==(const Calendar &lhs, const Calendar &rhs)
Date operator-(const Date &date, int numDays)
bool operator>=(const Date &lhs, const Date &rhs)
Date operator+(const Date &date, int numDays)
bsl::ostream & operator<<(bsl::ostream &stream, const Calendar &calendar)
bool operator<=(const Date &lhs, const Date &rhs)
void hashAppend(HASHALG &hashAlg, const Calendar &object)
bool operator!=(const Calendar &lhs, const Calendar &rhs)
Definition bdlbb_blob.h:576
Definition bdlt_timeunitratio.h:199
static const bsls::Types::Int64 k_S_PER_M
Definition bdlt_timeunitratio.h:285
static const int k_S_PER_M_32
Definition bdlt_timeunitratio.h:339
static const int k_H_PER_D_32
Definition bdlt_timeunitratio.h:346
static const int k_US_PER_MS_32
Definition bdlt_timeunitratio.h:330
static const int k_MS_PER_D_32
Definition bdlt_timeunitratio.h:337
static const bsls::Types::Int64 k_MS_PER_S
Definition bdlt_timeunitratio.h:280
static const bsls::Types::Int64 k_US_PER_H
Definition bdlt_timeunitratio.h:277
static const int k_M_PER_H_32
Definition bdlt_timeunitratio.h:343
static const bsls::Types::Int64 k_M_PER_H
Definition bdlt_timeunitratio.h:289
static const bsls::Types::Int64 k_US_PER_MS
Definition bdlt_timeunitratio.h:273
static const int k_MS_PER_S_32
Definition bdlt_timeunitratio.h:334
static const bsls::Types::Int64 k_US_PER_D
Definition bdlt_timeunitratio.h:278
static const bsls::Types::Int64 k_US_PER_S
Definition bdlt_timeunitratio.h:275
static const bsls::Types::Int64 k_US_PER_M
Definition bdlt_timeunitratio.h:276
long long Int64
Definition bsls_types.h:132