]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
include: Update utime.h to work without using namespace
authorAdam C. Emerson <aemerson@redhat.com>
Fri, 29 Mar 2019 01:01:37 +0000 (21:01 -0400)
committerAdam C. Emerson <aemerson@redhat.com>
Fri, 29 Mar 2019 14:30:36 +0000 (10:30 -0400)
Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
src/include/utime.h

index bc9f6429a12c1be8e4198b844886b40e5e39f2f4..c7c0ee6de9373295e7dfca739bc3b92d63c3bdbb 100644 (file)
@@ -87,19 +87,19 @@ public:
     ts->tv_sec = tv.tv_sec;
     ts->tv_nsec = tv.tv_nsec;
   }
-  void set_from_double(double d) { 
+  void set_from_double(double d) {
     tv.tv_sec = (__u32)trunc(d);
     tv.tv_nsec = (__u32)((d - (double)tv.tv_sec) * 1000000000.0);
   }
 
-  real_time to_real_time() const {
+  ceph::real_time to_real_time() const {
     ceph_timespec ts;
     encode_timeval(&ts);
     return ceph::real_clock::from_ceph_timespec(ts);
   }
 
   // accessors
-  time_t        sec()  const { return tv.tv_sec; } 
+  time_t        sec()  const { return tv.tv_sec; }
   long          usec() const { return tv.tv_nsec/1000; }
   int           nsec() const { return tv.tv_nsec; }
 
@@ -130,7 +130,7 @@ public:
       ,
       "utime_t have padding");
   }
-  void encode(bufferlist &bl) const {
+  void encode(ceph::buffer::list &bl) const {
 #if defined(CEPH_LITTLE_ENDIAN)
     bl.append((char *)(this), sizeof(__u32) + sizeof(__u32));
 #else
@@ -139,7 +139,7 @@ public:
     encode(tv.tv_nsec, bl);
 #endif
   }
-  void decode(bufferlist::const_iterator &p) {
+  void decode(ceph::buffer::list::const_iterator &p) {
 #if defined(CEPH_LITTLE_ENDIAN)
     p.copy(sizeof(__u32) + sizeof(__u32), (char *)(this));
 #else
@@ -212,7 +212,7 @@ public:
   }
 
   // output
-  ostream& gmtime(ostream& out) const {
+  std::ostream& gmtime(std::ostream& out) const {
     out.setf(std::ios::right);
     char oldfill = out.fill();
     out.fill('0');
@@ -241,7 +241,7 @@ public:
   }
 
   // output
-  ostream& gmtime_nsec(ostream& out) const {
+  std::ostream& gmtime_nsec(std::ostream& out) const {
     out.setf(std::ios::right);
     char oldfill = out.fill();
     out.fill('0');
@@ -270,7 +270,7 @@ public:
   }
 
   // output
-  ostream& asctime(ostream& out) const {
+  std::ostream& asctime(std::ostream& out) const {
     out.setf(std::ios::right);
     char oldfill = out.fill();
     out.fill('0');
@@ -295,8 +295,8 @@ public:
     out.unsetf(std::ios::right);
     return out;
   }
-  
-  ostream& localtime(ostream& out) const {
+
+  std::ostream& localtime(std::ostream& out) const {
     out.setf(std::ios::right);
     char oldfill = out.fill();
     out.fill('0');
@@ -371,8 +371,9 @@ public:
   }
 
 
-  static int parse_date(const string& date, uint64_t *epoch, uint64_t *nsec,
-                        string *out_date=NULL, string *out_time=NULL) {
+  static int parse_date(const std::string& date, uint64_t *epoch, uint64_t *nsec,
+                        std::string *out_date=nullptr,
+                       std::string *out_time=nullptr) {
     struct tm tm;
     memset(&tm, 0, sizeof(tm));
 
@@ -397,7 +398,7 @@ public:
             buf[i] = '0';
           }
           buf[i] = '\0';
-          string err;
+         std::string err;
           *nsec = (uint64_t)strict_strtol(buf, 10, &err);
           if (!err.empty()) {
             return -EINVAL;
@@ -436,7 +437,7 @@ public:
     return 0;
   }
 
-  bool parse(const string& s) {
+  bool parse(const std::string& s) {
     uint64_t epoch, nsec;
     int r = parse_date(s, &epoch, &nsec);
     if (r < 0) {
@@ -535,7 +536,7 @@ inline std::ostream& operator<<(std::ostream& out, const utime_t& t)
 
 inline std::string utimespan_str(const utime_t& age) {
   auto age_ts = ceph::timespan(age.nsec()) + std::chrono::seconds(age.sec());
-  return timespan_str(age_ts);
+  return ceph::timespan_str(age_ts);
 }
 
 #endif