121
126
inline void set_useconds(const uint32_t usecond) {_useconds= usecond;}
122
127
/** Returns the microsseconds component. */
123
128
inline uint32_t useconds() const {return _useconds;}
125
* Sets the epoch_seconds component automatically,
126
* based on the temporal's components.
130
* Sets the epoch_seconds component automatically,
131
* based on the temporal's components.
128
133
void set_epoch_seconds();
129
134
/** Sets the epch_seconds component manually. */
130
inline void set_epoch_seconds(const uint32_t epoch_second) {_epoch_seconds= epoch_second;}
135
inline void set_epoch_seconds(const uint32_t epoch_second)
136
{_epoch_seconds= epoch_second;}
131
137
/** Returns the UNIX epoch seconds component. */
132
138
inline time_t epoch_seconds() const {return _epoch_seconds;}
133
139
/** Sets the seconds component. */
207
216
* @param Date to compare against.
209
virtual bool operator==(const Date &rhs);
210
virtual bool operator!=(const Date &rhs);
211
virtual bool operator>(const Date &rhs);
212
virtual bool operator>=(const Date &rhs);
213
virtual bool operator<(const Date &rhs);
214
virtual bool operator<=(const Date &rhs);
218
bool operator==(const Date &rhs);
219
bool operator!=(const Date &rhs);
220
bool operator>(const Date &rhs);
221
bool operator>=(const Date &rhs);
222
bool operator<(const Date &rhs);
223
bool operator<=(const Date &rhs);
226
* Comparison operator overloads to compare a Date against
229
* @param DateTime to compare against.
231
bool operator==(const DateTime &rhs);
232
bool operator!=(const DateTime &rhs);
233
bool operator>(const DateTime &rhs);
234
bool operator>=(const DateTime &rhs);
235
bool operator<(const DateTime &rhs);
236
bool operator<=(const DateTime &rhs);
239
* Comparison operator overloads to compare a Date against
242
* @param Timestamp to compare against.
244
bool operator==(const Timestamp &rhs);
245
bool operator!=(const Timestamp &rhs);
246
bool operator>(const Timestamp &rhs);
247
bool operator>=(const Timestamp &rhs);
248
bool operator<(const Timestamp &rhs);
249
bool operator<=(const Timestamp &rhs);
216
252
* Operator overload for adding/subtracting another Date
217
* (or subclass) to/from this temporal. When subtracting
253
* (or subclass) to/from this temporal. When subtracting
218
254
* or adding two Dates, we return a new Date instance.
256
* @param Date instance to add/subtract to/from
258
const Date operator-(const Date &rhs);
259
const Date operator+(const Date &rhs);
260
Date& operator+=(const Date &rhs);
261
Date& operator-=(const Date &rhs);
264
* Operator to add/subtract a Time from a Time.
265
* We can return a Time new temporal instance.
220
267
* @param Temporal instance to add/subtract to/from
222
virtual const Date operator-(const Date &rhs);
223
virtual const Date operator+(const Date &rhs);
224
virtual Date& operator+=(const Date &rhs);
225
virtual Date& operator-=(const Date &rhs);
269
const Date operator-(const Time &rhs);
270
const Date operator+(const Time &rhs);
271
Date& operator-=(const Time &rhs);
272
Date& operator+=(const Time &rhs);
276
* Operator overload for adding/subtracting a DateTime
277
* (or subclass) to/from this temporal. When subtracting
278
* or adding two Dates, we return a new Date instance.
280
* @param DateTime instance to add/subtract to/from
282
const Date operator-(const DateTime &rhs);
283
const Date operator+(const DateTime &rhs);
284
Date& operator+=(const DateTime &rhs);
285
Date& operator-=(const DateTime &rhs);
289
* Operator overload for adding/subtracting a TemporalInterval
290
* instance to this temporal.
292
* @param TemporalInterval instance to add/subtract to/from
294
Date& operator+=(const TemporalIntervalYear &rhs);
295
Date& operator+=(const TemporalIntervalDayOrLess &rhs);
296
Date& operator+=(const TemporalIntervalDayOrWeek &rhs);
297
Date& operator+=(const TemporalIntervalYearMonth &rhs);
298
Date& operator-=(const TemporalIntervalYear &rhs);
299
Date& operator-=(const TemporalIntervalDayOrLess &rhs);
300
Date& operator-=(const TemporalIntervalDayOrWeek &rhs);
301
Date& operator-=(const TemporalIntervalYearMonth &rhs);
228
305
* Operator overload for when a DateTime instance is
493
575
DateTime() :Date() {}
495
* Comparison operator overloads to compare a DateTime against
496
* another DateTime value.
498
* @param DateTime to compare against.
500
virtual bool operator==(const DateTime &rhs);
501
virtual bool operator!=(const DateTime &rhs);
502
virtual bool operator>(const DateTime &rhs);
503
virtual bool operator>=(const DateTime &rhs);
504
virtual bool operator<(const DateTime &rhs);
505
virtual bool operator<=(const DateTime &rhs);
507
* Operator to add/subtract a Time from a Time.
508
* We can return a Time new temporal instance.
510
* @param Temporal instance to add/subtract to/from
512
const DateTime operator-(const Time &rhs);
513
const DateTime operator+(const Time &rhs);
514
DateTime& operator-=(const Time &rhs);
515
DateTime& operator+=(const Time &rhs);
517
* Operator overload for adding/subtracting another DateTime
518
* (or subclass) to/from this temporal. When subtracting
519
* or adding two DateTimes, we return a new DateTime instance.
521
* @param Temporal instance to add/subtract to/from
523
const DateTime operator-(const DateTime &rhs);
524
const DateTime operator+(const DateTime &rhs);
525
DateTime& operator+=(const DateTime &rhs);
526
DateTime& operator-=(const DateTime &rhs);
529
* Operator overload for adding/subtracting a TemporalInterval
530
* instance to this temporal.
532
* @param TemporalInterval instance to add/subtract to/from
534
DateTime& operator+=(const TemporalIntervalYear &rhs);
535
DateTime& operator+=(const TemporalIntervalDayOrLess &rhs);
536
DateTime& operator+=(const TemporalIntervalDayOrWeek &rhs);
537
DateTime& operator+=(const TemporalIntervalYearMonth &rhs);
538
DateTime& operator-=(const TemporalIntervalYear &rhs);
539
DateTime& operator-=(const TemporalIntervalDayOrLess &rhs);
540
DateTime& operator-=(const TemporalIntervalDayOrWeek &rhs);
541
DateTime& operator-=(const TemporalIntervalYearMonth &rhs);
543
577
friend class TemporalInterval;
545
/* Returns whether the DateTime (or subclass) instance is in the Unix Epoch. */
579
/** Returns whether the DateTime (or subclass) instance
580
* is in the Unix Epoch.
546
582
bool in_unix_epoch() const;
547
583
/** Returns whether the temporal value is valid datetime. */
548
584
virtual bool is_valid() const;
551
* It's not possible to convert to and from a DateTime and
587
* It's not possible to convert to and from a DateTime and
552
588
* a 4-byte integer, so let us know if we try and do it!
554
590
void to_int32_t(int32_t *) const {assert(0);}
629
665
* Class representing temporal components in the UNIX epoch
631
class Timestamp: public DateTime
667
class Timestamp: public DateTime
634
670
Timestamp() :DateTime() {}
636
* Comparison operator overloads to compare a Timestamp against
637
* another Timestamp value.
639
* @param Timestamp to compare against.
641
bool operator==(const Timestamp &rhs);
642
bool operator!=(const Timestamp &rhs);
643
bool operator>(const Timestamp &rhs);
644
bool operator>=(const Timestamp &rhs);
645
bool operator<(const Timestamp &rhs);
646
bool operator<=(const Timestamp &rhs);
648
672
bool is_valid_timestamp() const {return is_valid();}
649
673
/** Returns whether the temporal value is valid timestamp. */