Hyper API for C++ 0.0.20746
Hyper client library for C++ applications
Loading...
Searching...
No Matches
Time.hpp
Go to the documentation of this file.
1
5#ifndef TABLEAU_HYPER_TIME_HPP
6#define TABLEAU_HYPER_TIME_HPP
7
8#include <cstdint>
10#include <string>
11#include <hyperapi/hyperapi.h>
12
13namespace hyperapi {
14
18class Time final {
19 public:
23 struct raw_t {};
24
28 Time() noexcept {}
29
40 Time(int8_t hour, std::int8_t minute, std::int8_t second, std::int32_t microsecond = 0) noexcept;
41
47 explicit Time(hyper_time_t rawTime, raw_t) noexcept;
48
54 std::int8_t getHour() const noexcept;
55
61 std::int8_t getMinute() const noexcept;
62
68 std::int8_t getSecond() const noexcept;
69
75 std::int32_t getMicrosecond() const noexcept;
76
81 std::string toString() const;
87 hyper_time_t getRaw() const noexcept;
91 friend bool operator==(const Time& lhs, const Time& rhs) noexcept;
95 friend bool operator>(const Time& lhs, const Time& rhs) noexcept;
99 friend bool operator!=(const Time& a, const Time& b) noexcept { return !(a == b); }
103 friend bool operator<(const Time& a, const Time& b) noexcept { return (b > a); }
107 friend bool operator<=(const Time& a, const Time& b) noexcept { return !(a > b); }
111 friend bool operator>=(const Time& a, const Time& b) noexcept { return !(a < b); }
112
114 friend std::ostream& operator<<(std::ostream& os, const Time& obj) { return os << obj.toString(); }
115
116 private:
117 friend class Inserter;
118 friend class Value;
119 friend class OffsetTimestamp;
120 friend class Timestamp;
121 friend struct std::hash<hyperapi::Time>;
122 friend struct internal::ValueInserter;
123
127 hyper_time_t representation_ = 0;
128
130 hyper_time_components_t time_ = {0, 0, 0, 0};
131};
132}
133#include <hyperapi/impl/Time.impl.hpp>
134
135#endif
An inserter.
Definition Inserter.hpp:24
A timestamp data value with an offset to UTC.
A time data value.
Definition Time.hpp:18
Time() noexcept
Default constructor.
Definition Time.hpp:28
std::int8_t getSecond() const noexcept
Gets the second.
std::int32_t getMicrosecond() const noexcept
Gets the microsecond.
friend std::ostream & operator<<(std::ostream &os, const Time &obj)
Stream output operator.
Definition Time.hpp:114
std::int8_t getMinute() const noexcept
Gets the minute.
std::string toString() const
Gets a string representation for debugging.
friend bool operator<(const Time &a, const Time &b) noexcept
Less than operator.
Definition Time.hpp:103
friend bool operator>=(const Time &a, const Time &b) noexcept
Greater or equal operator.
Definition Time.hpp:111
std::int8_t getHour() const noexcept
Gets the hour.
Time(int8_t hour, std::int8_t minute, std::int8_t second, std::int32_t microsecond=0) noexcept
Creates a time value from separate time components.
hyper_time_t getRaw() const noexcept
Gets the raw time value encoded as microseconds since midnight.
friend bool operator<=(const Time &a, const Time &b) noexcept
Less than or equal operator.
Definition Time.hpp:107
Marker struct for the raw timestamp constructor.
Definition Time.hpp:23
A timestamp data value.
Definition Timestamp.hpp:16
A value inside a row.
Definition Result.hpp:44
The primary namespace of the Hyper API for C++.
Definition ByteSpan.hpp:15