diff --git a/js/CCNTime.js b/js/CCNTime.js
new file mode 100644
index 0000000..5aafca1
--- /dev/null
+++ b/js/CCNTime.js
@@ -0,0 +1,99 @@
+/*
+ * @author: ucla-cs
+ * This class represents CCNTime Objects
+ */
+
+var CCNTime = function CCNTime(
+                               //long 
+msec) {
+
+
+
+
+	this.NANOS_MAX = 999877929;
+	
+	this.date = new Date(msec);
+};
+
+
+	/**
+	 * Create a CCNTime
+	 * @param timestamp source timestamp to initialize from, some precision will be lost
+	 */
+
+	/**
+	 * Create a CCNTime
+	 * @param time source Date to initialize from, some precision will be lost
+	 * as CCNTime does not round to unitary milliseconds
+	 */
+CCNTime.prototype.setDate = function(
+	//Date 
+		date) {
+
+	this.date = date;
+};
+	
+	/**
+	 * Create a CCNTime from its binary encoding
+	 * @param binaryTime12 the binary representation of a CCNTime
+	 */
+CCNTime.prototype.setDateBinary = function(
+	//byte [] 
+		binaryTime12) {
+
+
+	if ((null == binaryTime12) || (binaryTime12.length == 0)) {
+		throw new IllegalArgumentException("Invalid binary time!");
+	}
+	
+
+	value = 0;
+	for(i = 0; i < binaryTime12.length; i++) {
+		value = value << 8;
+		// Java will assume the byte is signed, so extend it and trim it.
+		b = (binaryTime12[i]) & 0xFF;
+		value |= b;
+	}
+	
+	this.date = new Date(value);
+
+};
+
+//byte[]
+CCNTime.prototype.toBinaryTime = function() {
+	
+	
+
+	return unsignedLongToByteArray(this.date.getTime());
+
+}
+
+unsignedLongToByteArray= function( value) {
+	if( 0 == value )
+		return [0];
+
+	if( 0 <= value && value <= 0x00FF ) {
+		//byte [] 
+		bb = new Array[1];
+		bb[0] = (value & 0x00FF);
+		return bb;
+	}
+
+	
+	//byte [] 
+	out = null;
+	//int
+	offset = -1;
+	for(var i = 7; i >=0; --i) {
+		//byte
+		b = ((value >> (i * 8)) & 0xFF);
+		if( out == null && b != 0 ) {
+			out = new Array(i+1);//byte[i+1];
+			offset = i;
+		}
+		if( out != null )
+			out[ offset - i ] = b;
+	}
+	return out;
+}
+	
