Author: jbellis
Date: Sat Mar 20 22:50:04 2010
New Revision: 925700

URL: http://svn.apache.org/viewvc?rev=925700&view=rev
Log:
Use microseconds-since-epoch (UTC) in cli, instead of milliseconds.  patch by 
jbellis

Modified:
    cassandra/branches/cassandra-0.6/CHANGES.txt
    
cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/cli/CliClient.java

Modified: cassandra/branches/cassandra-0.6/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.6/CHANGES.txt?rev=925700&r1=925699&r2=925700&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.6/CHANGES.txt (original)
+++ cassandra/branches/cassandra-0.6/CHANGES.txt Sat Mar 20 22:50:04 2010
@@ -8,6 +8,7 @@
    (CASSANDRA-907)
  * bound read, mutation, and response stages to fix possible OOM
    during log replay (CASSANDRA-885)
+ * Use microseconds-since-epoch (UTC) in cli, instead of milliseconds
 
 
 0.6.0-beta3

Modified: 
cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/cli/CliClient.java
URL: 
http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/cli/CliClient.java?rev=925700&r1=925699&r2=925700&view=diff
==============================================================================
--- 
cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/cli/CliClient.java
 (original)
+++ 
cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/cli/CliClient.java
 Sat Mar 20 22:50:04 2010
@@ -247,10 +247,17 @@ public class CliClient 
         }
         
         thriftClient_.remove(tableName, key, createColumnPath(columnFamily, 
superColumnName, columnName),
-                             System.currentTimeMillis(), ConsistencyLevel.ONE);
+                             timestampMicros(), ConsistencyLevel.ONE);
         css_.out.println(String.format("%s removed.", (columnSpecCnt == 0) ? 
"row" : "column"));
-    }  
-    
+    }
+
+    private static long timestampMicros()
+    {
+        // we use microsecond resolution for compatibility with other client 
libraries, even though
+        // we can't actually get microsecond precision.
+        return System.currentTimeMillis() * 1000;
+    }
+
     private void doSlice(String keyspace, String key, String columnFamily, 
byte[] superColumnName)
             throws InvalidRequestException, UnavailableException, 
TimedOutException, TException, UnsupportedEncodingException, 
IllegalAccessException, NotFoundException, InstantiationException, 
ClassNotFoundException
     {
@@ -424,7 +431,7 @@ public class CliClient 
         
         // do the insert
         thriftClient_.insert(tableName, key, createColumnPath(columnFamily, 
superColumnName, columnName),
-                             value.getBytes(), System.currentTimeMillis(), 
ConsistencyLevel.ONE);
+                             value.getBytes(), timestampMicros(), 
ConsistencyLevel.ONE);
         
         css_.out.println("Value inserted.");
     }
@@ -436,7 +443,6 @@ public class CliClient 
 
         String propertyValue = thriftClient_.get_string_property(propertyName);
         css_.out.println(propertyValue);
-        return;
     }
 
     // process "show tables" statement
@@ -488,8 +494,6 @@ public class CliClient 
         } catch (NotFoundException e) {
             css_.out.println("Keyspace " + tableName + " could not be found.");
         }
-        
-        return;
     }
 
     // process a statement of the form: connect hostname/port


Reply via email to