Example usage for org.apache.commons.net.ntp TimeStamp getDate

List of usage examples for org.apache.commons.net.ntp TimeStamp getDate

Introduction

In this page you can find the example usage for org.apache.commons.net.ntp TimeStamp getDate.

Prototype

public Date getDate() 

Source Link

Document

Convert NTP timestamp to Java Date object.

Usage

From source file:eu.learnpad.simulator.mon.utils.DebugMessages.java

/**
 * Print the string "className : message " with break line.
 * Can be used with method {@link #ok()}
 * /* w  w w . j ava  2  s  .  co m*/
 * @param callerClass the name of the class that is calling method
 * @param messageToPrint the message to print
 */
public static void println(TimeStamp now, String callerClass, String messageToPrint) {
    String message = now.getDate().toString() + " - " + callerClass + ": " + messageToPrint;
    System.err.println(message);
}

From source file:eu.learnpad.simulator.mon.utils.DebugMessages.java

/**
 * Print the string "className : message " without break line.
 * Can be used with method {@link #ok()}
 * //from  www.jav a  2  s.  c  om
 * @param callerClass the name of the class that is calling method
 * @param messageToPrint the message to print
 */

public static void print(TimeStamp now, String callerClass, String messageToPrint) {
    String message = now.getDate().toString() + " - " + callerClass + ": " + messageToPrint;
    System.err.print(message);
    lastMessageLength = message.length();
}

From source file:it.cnr.isti.labse.glimpse.utils.DebugMessages.java

/**
 * Print the string "className : message " without break line.
 * Can be used with method {@link #ok()}
 * // w w w.  j a v  a2s  .  co m
 * @param callerClass the name of the class that is calling method
 * @param messageToPrint the message to print
 */

//   public static Logger getLogFileSingleton() {   
//      if (DebugAndLogMessages.logFile == null)
//         return DebugAndLogMessages.logFile = new File(
//               System.getProperty("user.dir") + "/glimpseLog.log");
//      return DebugAndLogMessages.logFile;      
//  }

public static void print(TimeStamp now, String callerClass, String messageToPrint) {
    String message = now.getDate().toString() + " - " + callerClass + ": " + messageToPrint;
    System.err.print(message);
    lastMessageLength = message.length();
}

From source file:com.bigdata.hbase.HBase.java

public void writeIntoTable(String colFamily, String colQualifier, String value) throws Exception {
    Connection c = pool.borrowObject();
    TableName tableName = TableName.valueOf(this.table);
    Table t = c.getTable(tableName);//  w  w  w. jav a2s.  c o  m
    TimeStamp ts = new TimeStamp(new Date());
    Date d = ts.getDate();
    Put p = new Put(Bytes.toBytes(d.toString()));
    p.addColumn(Bytes.toBytes(colFamily), Bytes.toBytes(colQualifier), Bytes.toBytes(value));
    t.put(p);
    t.close();
    pool.returnObject(c);
}

From source file:com.eventsourcing.hlc.HybridTimestampTest.java

@Test
public void initialTimestamp() {
    HybridTimestamp timestamp = new HybridTimestamp(physicalTimeProvider);
    TimeStamp ntpTime = new TimeStamp(timestamp.getLogicalTime());
    assertEquals(ntpTime.getDate(), new Date(0));
}