aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/timezone_conversion/civil-inl.h
blob: 32afbccb642266d449305c6d04b678fd75a2204d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#pragma once

#include "civil.h"

namespace NDatetime {
    namespace NDetail {
        template <typename T>
        struct TGetCivilUnit;

        template <>
        struct TGetCivilUnit<TCivilSecond> {
            static constexpr ECivilUnit Value = ECivilUnit::Second;
        };
        template <>
        struct TGetCivilUnit<TCivilMinute> {
            static constexpr ECivilUnit Value = ECivilUnit::Minute;
        };
        template <>
        struct TGetCivilUnit<TCivilHour> {
            static constexpr ECivilUnit Value = ECivilUnit::Hour;
        };
        template <>
        struct TGetCivilUnit<TCivilDay> {
            static constexpr ECivilUnit Value = ECivilUnit::Day;
        };
        template <>
        struct TGetCivilUnit<TCivilMonth> {
            static constexpr ECivilUnit Value = ECivilUnit::Month;
        };
        template <>
        struct TGetCivilUnit<TCivilYear> {
            static constexpr ECivilUnit Value = ECivilUnit::Year;
        };

        template <ECivilUnit Unit>
        struct TGetCivilTime;

        template <>
        struct TGetCivilTime<ECivilUnit::Second> {
            using TResult = TCivilSecond;
        };
        template <>
        struct TGetCivilTime<ECivilUnit::Minute> {
            using TResult = TCivilMinute;
        };
        template <>
        struct TGetCivilTime<ECivilUnit::Hour> {
            using TResult = TCivilHour;
        };
        template <>
        struct TGetCivilTime<ECivilUnit::Day> {
            using TResult = TCivilDay;
        };
        template <>
        struct TGetCivilTime<ECivilUnit::Month> {
            using TResult = TCivilMonth;
        };
        template <>
        struct TGetCivilTime<ECivilUnit::Year> {
            using TResult = TCivilYear;
        };
    }
}