Per code review:
authorReid Spencer <rspencer@reidspencer.com>
Tue, 16 Nov 2004 06:22:17 +0000 (06:22 +0000)
committerReid Spencer <rspencer@reidspencer.com>
Tue, 16 Nov 2004 06:22:17 +0000 (06:22 +0000)
* get rid of (void) construct in function declarations
* make toString a const member
* add a default implementation of toString for Win32

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17873 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/System/TimeValue.h
lib/System/Unix/TimeValue.cpp
lib/System/Unix/TimeValue.inc
lib/System/Win32/TimeValue.cpp
lib/System/Win32/TimeValue.inc

index 6e5e271c98e46e269f2157e1e7f3079e9974001e..93afca9f4b3f2edb895f8a5c2b2ff560c08bf975 100644 (file)
@@ -195,24 +195,24 @@ namespace sys {
     /// Returns only the seconds component of the TimeValue. The nanoseconds
     /// portion is ignored. No rounding is performed.
     /// @brief Retrieve the seconds component
-    SecondsType seconds( void ) const { return seconds_; }
+    SecondsType seconds() const { return seconds_; }
 
     /// Returns only the nanoseconds component of the TimeValue. The seconds
     /// portion is ignored. 
     /// @brief Retrieve the nanoseconds component.
-    NanoSecondsType nanoseconds( void ) const { return nanos_; }
+    NanoSecondsType nanoseconds() const { return nanos_; }
 
     /// Returns only the fractional portion of the TimeValue rounded down to the
     /// nearest microsecond (divide by one thousand).
     /// @brief Retrieve the fractional part as microseconds;
-    uint32_t microseconds( void ) const { 
+    uint32_t microseconds() const { 
       return nanos_ / NANOSECONDS_PER_MICROSECOND;
     }
 
     /// Returns only the fractional portion of the TimeValue rounded down to the
     /// nearest millisecond (divide by one million).
     /// @brief Retrieve the fractional part as milliseconds;
-    uint32_t milliseconds( void ) const {
+    uint32_t milliseconds() const {
       return nanos_ / NANOSECONDS_PER_MILLISECOND;
     }
 
@@ -221,7 +221,7 @@ namespace sys {
     /// the range of a TimeValue. Nevertheless, this is useful on some operating
     /// systems and is therefore provided.
     /// @brief Convert to a number of microseconds (can overflow)
-    uint64_t usec( void ) const {
+    uint64_t usec() const {
       return seconds_ * MICROSECONDS_PER_SECOND + 
              ( nanos_ / NANOSECONDS_PER_MICROSECOND );
     }
@@ -231,7 +231,7 @@ namespace sys {
     /// the range of a TimeValue. Nevertheless, this is useful on some operating
     /// systems and is therefore provided.
     /// @brief Convert to a number of milliseconds (can overflow)
-    uint64_t msec( void ) const {
+    uint64_t msec() const {
       return seconds_ * MILLISECONDS_PER_SECOND + 
              ( nanos_ / NANOSECONDS_PER_MILLISECOND );
     }
@@ -239,7 +239,7 @@ namespace sys {
     /// Converts the TimeValue into the corresponding number of "ticks" for
     /// Posix, correcting for the difference in Posix zero time.
     /// @brief Convert to unix time (100 nanoseconds since 12:00:00a Jan 1,1970)
-    uint64_t toPosixTime( void ) const {
+    uint64_t toPosixTime() const {
       uint64_t result = seconds_ - PosixZeroTime.seconds_;
       result += nanos_ / NANOSECONDS_PER_POSIX_TICK;
       return result;
@@ -247,14 +247,14 @@ namespace sys {
 
     /// Converts the TimeValue into the corresponding number of seconds 
     /// since the epoch (00:00:00 Jan 1,1970). 
-    uint64_t toEpochTime(void) const {
+    uint64_t toEpochTime() const {
       return seconds_ - PosixZeroTime.seconds_;
     }
 
     /// Converts the TiemValue into the correspodning number of "ticks" for
     /// Win32 platforms, correcting for the difference in Win32 zero time.
     /// @brief Convert to windows time (seconds since 12:00:00a Jan 1, 1601)
-    uint64_t toWin32Time( void ) const {
+    uint64_t toWin32Time() const {
       uint64_t result = seconds_ - Win32ZeroTime.seconds_;
       result += nanos_ / NANOSECONDS_PER_WIN32_TICK;
       return result;
@@ -271,7 +271,7 @@ namespace sys {
     /// Provides conversion of the TimeValue into a readable time & date.
     /// @returns std::string containing the readable time value
     /// @brief Convert time to a string.
-    std::string toString();
+    std::string toString() const;
 
   /// @}
   /// @name Mutators
@@ -343,7 +343,7 @@ namespace sys {
     /// This causes the values to be represented so that the fractional
     /// part is minimized, possibly incrementing the seconds part.
     /// @brief Normalize to canonical form.
-    void normalize (void);
+    void normalize();
 
 /// @}
   /// @name Data
index d140af9add79b52e9ef98f1d0f357bb1e873ddb0..0642aa58c3ae8ebb456c3171cfa5d6654214fc6c 100644 (file)
@@ -25,7 +25,7 @@ namespace llvm {
   using namespace sys;
 
 
-std::string TimeValue::toString() {
+std::string TimeValue::toString() const {
   char buffer[32];
 
   time_t ourTime = time_t(this->toEpochTime());
index d140af9add79b52e9ef98f1d0f357bb1e873ddb0..0642aa58c3ae8ebb456c3171cfa5d6654214fc6c 100644 (file)
@@ -25,7 +25,7 @@ namespace llvm {
   using namespace sys;
 
 
-std::string TimeValue::toString() {
+std::string TimeValue::toString() const {
   char buffer[32];
 
   time_t ourTime = time_t(this->toEpochTime());
index 433b948748544a12454f33f09bdf407afa212836..eab776fc17fd52e88d5d3365ca83f3c8051f1513 100644 (file)
@@ -30,6 +30,10 @@ TimeValue TimeValue::now() {
     static_cast<TimeValue::NanoSecondsType>( (ft % 10000000) * 100) );
 }
 
+std::string TimeValue::toString() const {
+  return "Don't know how to conver time on Win32";
+}
+
 // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab
 
 }
index 433b948748544a12454f33f09bdf407afa212836..eab776fc17fd52e88d5d3365ca83f3c8051f1513 100644 (file)
@@ -30,6 +30,10 @@ TimeValue TimeValue::now() {
     static_cast<TimeValue::NanoSecondsType>( (ft % 10000000) * 100) );
 }
 
+std::string TimeValue::toString() const {
+  return "Don't know how to conver time on Win32";
+}
+
 // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab
 
 }