[ 
https://issues.apache.org/jira/browse/GEODE-3136?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16242391#comment-16242391
 ] 

ASF GitHub Bot commented on GEODE-3136:
---------------------------------------

dgkimura commented on a change in pull request #144: GEODE-3136: Convert time 
values to std::chrono::duration.
URL: https://github.com/apache/geode-native/pull/144#discussion_r149408979
 
 

 ##########
 File path: cppcache/include/geode/util/chrono/duration.hpp
 ##########
 @@ -0,0 +1,156 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#ifndef GEODE_UTIL_CHRONO_DURATION_H_
+#define GEODE_UTIL_CHRONO_DURATION_H_
+
+#include <string>
+#include <chrono>
+#include <type_traits>
+#include <stdexcept>
+
+namespace apache {
+namespace geode {
+namespace util {
+namespace chrono {
+namespace duration {
+
+template <class Duration>
+struct _suffix {
+  static constexpr char const* value = nullptr;
+};
+template <>
+struct _suffix<std::chrono::hours> {
+  static constexpr char const* value = "h";
+};
+template <>
+struct _suffix<std::chrono::minutes> {
+  static constexpr char const* value = "min";
+};
+template <>
+struct _suffix<std::chrono::seconds> {
+  static constexpr char const* value = "s";
+};
+template <>
+struct _suffix<std::chrono::milliseconds> {
+  static constexpr char const* value = "ms";
+};
+template <>
+struct _suffix<std::chrono::microseconds> {
+  static constexpr char const* value = "us";
+};
+template <>
+struct _suffix<std::chrono::nanoseconds> {
+  static constexpr char const* value = "ns";
+};
+
+template <class T>
+struct _is_duration : std::false_type {};
+
+template <class Rep, class Period>
+struct _is_duration<std::chrono::duration<Rep, Period>> : std::true_type {};
+
+template <class Rep, class Period>
+struct _is_duration<const std::chrono::duration<Rep, Period>> : std::true_type 
{
+};
+
+template <class Rep, class Period>
+struct _is_duration<volatile std::chrono::duration<Rep, Period>>
 
 Review comment:
   Can you explain why we need volatile here?  Are all these specializations 
needed and used?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> Replace all public API time values with std::chrono types
> ---------------------------------------------------------
>
>                 Key: GEODE-3136
>                 URL: https://issues.apache.org/jira/browse/GEODE-3136
>             Project: Geode
>          Issue Type: Improvement
>          Components: native client
>            Reporter: Jacob S. Barrett
>            Assignee: Jacob S. Barrett
>
> Remove ambiguity of time values by using 
> [{{std::chrono}}|http://en.cppreference.com/w/cpp/chrono] types in the public 
> API. 



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to