geode-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (GEODE-3136) Replace all public API time values with std::chrono types
Date Tue, 07 Nov 2017 17:23:00 GMT

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

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

pivotal-jbarrett 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_r149443175
 
 

 ##########
 File path: cppcache/test/util/chrono/durationTest.cpp
 ##########
 @@ -0,0 +1,68 @@
+/*
+ * 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.
+ */
+
+#include <chrono>
+
+#include <gtest/gtest.h>
+
+#include <geode/util/chrono/duration.hpp>
+
+using namespace apache::geode::util::chrono::duration;
+
+TEST(util_chrono_durationTest, ceil) {
+  EXPECT_EQ(std::chrono::seconds(1),
+            _ceil<std::chrono::seconds>(std::chrono::milliseconds(1)));
+  EXPECT_EQ(std::chrono::milliseconds(1),
+            _ceil<std::chrono::milliseconds>(std::chrono::milliseconds(1)));
+  EXPECT_EQ(std::chrono::microseconds(1000),
+            _ceil<std::chrono::milliseconds>(std::chrono::milliseconds(1)));
+}
+
+TEST(util_chrono_durationTest, to_string) {
+  EXPECT_EQ("42h", to_string(std::chrono::hours(42)));
+  EXPECT_EQ("42min", to_string(std::chrono::minutes(42)));
+  EXPECT_EQ("42s", to_string(std::chrono::seconds(42)));
+  EXPECT_EQ("42ms", to_string(std::chrono::milliseconds(42)));
+  EXPECT_EQ("42us", to_string(std::chrono::microseconds(42)));
+  EXPECT_EQ("42ns", to_string(std::chrono::nanoseconds(42)));
+}
+
+TEST(util_chrono_durationTest, from_string) {
 
 Review comment:
   Good idea. Should give negative durations.

----------------------------------------------------------------
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:
users@infra.apache.org


> 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)

Mime
View raw message