civil-inl.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #pragma once
  2. #include "civil.h"
  3. namespace NDatetime {
  4. namespace NDetail {
  5. template <typename T>
  6. struct TGetCivilUnit;
  7. template <>
  8. struct TGetCivilUnit<TCivilSecond> {
  9. static constexpr ECivilUnit Value = ECivilUnit::Second;
  10. };
  11. template <>
  12. struct TGetCivilUnit<TCivilMinute> {
  13. static constexpr ECivilUnit Value = ECivilUnit::Minute;
  14. };
  15. template <>
  16. struct TGetCivilUnit<TCivilHour> {
  17. static constexpr ECivilUnit Value = ECivilUnit::Hour;
  18. };
  19. template <>
  20. struct TGetCivilUnit<TCivilDay> {
  21. static constexpr ECivilUnit Value = ECivilUnit::Day;
  22. };
  23. template <>
  24. struct TGetCivilUnit<TCivilMonth> {
  25. static constexpr ECivilUnit Value = ECivilUnit::Month;
  26. };
  27. template <>
  28. struct TGetCivilUnit<TCivilYear> {
  29. static constexpr ECivilUnit Value = ECivilUnit::Year;
  30. };
  31. template <ECivilUnit Unit>
  32. struct TGetCivilTime;
  33. template <>
  34. struct TGetCivilTime<ECivilUnit::Second> {
  35. using TResult = TCivilSecond;
  36. };
  37. template <>
  38. struct TGetCivilTime<ECivilUnit::Minute> {
  39. using TResult = TCivilMinute;
  40. };
  41. template <>
  42. struct TGetCivilTime<ECivilUnit::Hour> {
  43. using TResult = TCivilHour;
  44. };
  45. template <>
  46. struct TGetCivilTime<ECivilUnit::Day> {
  47. using TResult = TCivilDay;
  48. };
  49. template <>
  50. struct TGetCivilTime<ECivilUnit::Month> {
  51. using TResult = TCivilMonth;
  52. };
  53. template <>
  54. struct TGetCivilTime<ECivilUnit::Year> {
  55. using TResult = TCivilYear;
  56. };
  57. }
  58. }