sparrow
2.4.0
C++20 idiomatic APIs for the Apache Arrow Columnar Format
Toggle main menu visibility
Loading...
Searching...
No Matches
timestamp_without_timezone_types.hpp
Go to the documentation of this file.
1
// Copyright 2024 Man Group Operations Limited
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
// http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or mplied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14
15
#pragma once
16
17
#include <chrono>
18
19
namespace
sparrow
20
{
24
struct
zoned_time_without_timezone_seconds
:
public
std::chrono::duration
<int64_t>
25
{
26
zoned_time_without_timezone_seconds
() =
default
;
27
28
constexpr
explicit
zoned_time_without_timezone_seconds
(int64_t seconds)
29
:
std
::
chrono
::duration<int64_t>(seconds)
30
{
31
}
32
};
33
37
struct
zoned_time_without_timezone_milliseconds
:
public
std::chrono::duration
<int64_t, std::milli>
38
{
39
zoned_time_without_timezone_milliseconds
() =
default
;
40
41
constexpr
explicit
zoned_time_without_timezone_milliseconds
(int64_t milliseconds)
42
:
std
::
chrono
::duration<int64_t,
std
::milli>(milliseconds)
43
{
44
}
45
};
46
50
struct
zoned_time_without_timezone_microseconds
:
public
std::chrono::duration
<int64_t, std::micro>
51
{
52
zoned_time_without_timezone_microseconds
() =
default
;
53
54
constexpr
explicit
zoned_time_without_timezone_microseconds
(int64_t microseconds)
55
:
std
::
chrono
::duration<int64_t,
std
::micro>(microseconds)
56
{
57
}
58
};
59
63
struct
zoned_time_without_timezone_nanoseconds
:
public
std::chrono::duration
<int64_t, std::nano>
64
{
65
zoned_time_without_timezone_nanoseconds
() =
default
;
66
67
constexpr
explicit
zoned_time_without_timezone_nanoseconds
(int64_t nanoseconds)
68
:
std
::
chrono
::duration<int64_t,
std
::nano>(nanoseconds)
69
{
70
}
71
};
72
}
73
74
75
#if defined(__cpp_lib_format)
76
77
# include <format>
78
79
template
<
typename
T>
80
requires
std::same_as<T, sparrow::zoned_time_without_timezone_seconds>
81
|| std::same_as<T, sparrow::zoned_time_without_timezone_milliseconds>
82
|| std::same_as<T, sparrow::zoned_time_without_timezone_microseconds>
83
|| std::same_as<T, sparrow::zoned_time_without_timezone_nanoseconds>
84
struct
std::formatter<T>
85
{
86
constexpr
auto
parse(std::format_parse_context& ctx)
87
{
88
return
ctx.begin();
// Simple implementation
89
}
90
91
auto
format(
const
T& time, std::format_context& ctx)
const
92
{
93
return
std::format_to(ctx.out(),
"{}"
, time.count());
94
}
95
};
96
97
#endif
std::chrono::duration
sparrow::chrono
Definition
temporal_types.hpp:20
sparrow
Definition
array.hpp:21
std
Extensions to the C++ standard library.
Definition
float16_t.hpp:1916
sparrow::zoned_time_without_timezone_microseconds::zoned_time_without_timezone_microseconds
zoned_time_without_timezone_microseconds()=default
sparrow::zoned_time_without_timezone_microseconds::zoned_time_without_timezone_microseconds
constexpr zoned_time_without_timezone_microseconds(int64_t microseconds)
Definition
timestamp_without_timezone_types.hpp:54
sparrow::zoned_time_without_timezone_milliseconds::zoned_time_without_timezone_milliseconds
constexpr zoned_time_without_timezone_milliseconds(int64_t milliseconds)
Definition
timestamp_without_timezone_types.hpp:41
sparrow::zoned_time_without_timezone_milliseconds::zoned_time_without_timezone_milliseconds
zoned_time_without_timezone_milliseconds()=default
sparrow::zoned_time_without_timezone_nanoseconds::zoned_time_without_timezone_nanoseconds
zoned_time_without_timezone_nanoseconds()=default
sparrow::zoned_time_without_timezone_nanoseconds::zoned_time_without_timezone_nanoseconds
constexpr zoned_time_without_timezone_nanoseconds(int64_t nanoseconds)
Definition
timestamp_without_timezone_types.hpp:67
sparrow::zoned_time_without_timezone_seconds::zoned_time_without_timezone_seconds
zoned_time_without_timezone_seconds()=default
sparrow::zoned_time_without_timezone_seconds::zoned_time_without_timezone_seconds
constexpr zoned_time_without_timezone_seconds(int64_t seconds)
Definition
timestamp_without_timezone_types.hpp:28
sparrow
layout
timestamp_without_timezone_types.hpp
Generated by
1.17.0