[Groonga-commit] groonga/grnxx [master] Remove grnxx::TIME_INVALID_NANOSECONDS.

Back to archive index

susumu.yata null+****@clear*****
Thu Dec 6 10:08:28 JST 2012


susumu.yata	2012-12-06 10:08:28 +0900 (Thu, 06 Dec 2012)

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

  Log:
    Remove grnxx::TIME_INVALID_NANOSECONDS.

  Modified files:
    lib/time.hpp
    test/test_time.cpp

  Modified: lib/time.hpp (+1 -11)
===================================================================
--- lib/time.hpp    2012-12-06 10:04:13 +0900 (a1b4b38)
+++ lib/time.hpp    2012-12-06 10:08:28 +0900 (584df22)
@@ -23,24 +23,14 @@
 
 namespace grnxx {
 
-const int64_t TIME_INVALID_NANOSECONDS = std::numeric_limits<int64_t>::min();
-
 class Time {
  public:
-  Time() : nanoseconds_(TIME_INVALID_NANOSECONDS) {}
+  Time() = default;
   explicit Time(int64_t nanoseconds) : nanoseconds_(nanoseconds) {}
 
   static Time now();
   static Time now_in_seconds();
 
-  static Time invalid_time() {
-    return Time();
-  }
-
-  explicit operator bool() const {
-    return nanoseconds_ != TIME_INVALID_NANOSECONDS;
-  }
-
   int64_t nanoseconds() const {
     return nanoseconds_;
   }

  Modified: test/test_time.cpp (+4 -7)
===================================================================
--- test/test_time.cpp    2012-12-06 10:04:13 +0900 (ce52a36)
+++ test/test_time.cpp    2012-12-06 10:08:28 +0900 (d415dcf)
@@ -25,14 +25,11 @@ int main() {
                            grnxx::LOGGER_ENABLE_COUT);
   grnxx::Logger::set_max_level(grnxx::NOTICE_LOGGER);
 
-  grnxx::Time time;
+  grnxx::Time time = grnxx::Time::now();
+  GRNXX_NOTICE() << "grnxx::Time::now: " << time;
 
-  assert(time == time.invalid_time());
-  assert(!time);
-
-  GRNXX_NOTICE() << "grnxx::Time::now: " << grnxx::Time::now();
-  GRNXX_NOTICE() << "grnxx::Time::now_in_seconds: "
-                 << grnxx::Time::now_in_seconds();
+  time = grnxx::Time::now_in_seconds();
+  GRNXX_NOTICE() << "grnxx::Time::now_in_seconds: " << time;
 
   enum { LOOP_COUNT = 1 << 16 };
 
-------------- next part --------------
HTML����������������������������...
Télécharger 



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