[Groonga-commit] groonga/grnxx [master] Add a skeleten of grnxx::PeriodicClock.

Back to archive index

susumu.yata null+****@clear*****
Thu Mar 14 12:28:33 JST 2013


susumu.yata	2013-03-14 12:28:33 +0900 (Thu, 14 Mar 2013)

  New Revision: d40097265e5450d406e08e8bdeb791d4794ca5a9
  https://github.com/groonga/grnxx/commit/d40097265e5450d406e08e8bdeb791d4794ca5a9

  Message:
    Add a skeleten of grnxx::PeriodicClock.

  Added files:
    lib/time/periodic_clock.cpp
    lib/time/periodic_clock.hpp
  Modified files:
    lib/time/Makefile.am

  Modified: lib/time/Makefile.am (+2 -0)
===================================================================
--- lib/time/Makefile.am    2013-03-13 16:22:13 +0900 (88add27)
+++ lib/time/Makefile.am    2013-03-14 12:28:33 +0900 (2511296)
@@ -6,6 +6,7 @@ libgrnxx_time_la_SOURCES =	\
 	broken_down_time.cpp	\
 	duration.cpp		\
 	internal_clock.cpp	\
+	periodic_clock.cpp	\
 	stopwatch.cpp		\
 	system_clock.cpp	\
 	time.cpp
@@ -15,6 +16,7 @@ libgrnxx_time_include_HEADERS =	\
 	broken_down_time.hpp	\
 	duration.hpp		\
 	internal_clock.hpp	\
+	periodic_clock.hpp	\
 	stopwatch.hpp		\
 	system_clock.hpp	\
 	time.hpp

  Added: lib/time/periodic_clock.cpp (+37 -0) 100644
===================================================================
--- /dev/null
+++ lib/time/periodic_clock.cpp    2013-03-14 12:28:33 +0900 (af5e22c)
@@ -0,0 +1,37 @@
+/*
+  Copyright (C) 2013  Brazil, Inc.
+
+  This library is free software; you can redistribute it and/or
+  modify it under the terms of the GNU Lesser General Public
+  License as published by the Free Software Foundation; either
+  version 2.1 of the License, or (at your option) any later version.
+
+  This library is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+  Lesser General Public License for more details.
+
+  You should have received a copy of the GNU Lesser General Public
+  License along with this library; if not, write to the Free Software
+  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+*/
+#include "time/periodic_clock.hpp"
+
+namespace grnxx {
+namespace {
+
+// TODO
+
+}  // namespace
+
+Time PeriodicClock::now_ = Time::min();
+
+PeriodicClock::PeriodicClock() {
+  // TODO
+}
+
+PeriodicClock::~PeriodicClock() {
+  // TODO
+}
+
+}  // namespace grnxx

  Added: lib/time/periodic_clock.hpp (+41 -0) 100644
===================================================================
--- /dev/null
+++ lib/time/periodic_clock.hpp    2013-03-14 12:28:33 +0900 (3823a7c)
@@ -0,0 +1,41 @@
+/*
+  Copyright (C) 2013  Brazil, Inc.
+
+  This library is free software; you can redistribute it and/or
+  modify it under the terms of the GNU Lesser General Public
+  License as published by the Free Software Foundation; either
+  version 2.1 of the License, or (at your option) any later version.
+
+  This library is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+  Lesser General Public License for more details.
+
+  You should have received a copy of the GNU Lesser General Public
+  License along with this library; if not, write to the Free Software
+  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+*/
+#ifndef GRNXX_TIME_PERIODIC_CLOCK_HPP
+#define GRNXX_TIME_PERIODIC_CLOCK_HPP
+
+#include "basic.hpp"
+#include "time/system_clock.hpp"
+
+namespace grnxx {
+
+class PeriodicClock {
+ public:
+  PeriodicClock();
+  ~PeriodicClock();
+
+  Time now() const {
+    return (now_ == Time::min()) ? SystemClock::now() : now_;
+  }
+
+ private:
+  static Time now_;
+};
+
+}  // namespace grnxx
+
+#endif  // GRNXX_TIME_PERIODIC_CLOCK_HPP
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index