Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.util.Date;

public class Main {
    /**
     * Takes the event's uptime timestamp, and
     * computes the UTC timestamp, in nanos.
     * 
     * @param eventTimestamp   The evnt
     * @return   The timestamp in nanos.
     */
    public static long computeJavaTimeStamp(long eventTimestamp) {
        long javaTime = new Date().getTime();
        long nanoTime = System.nanoTime();
        long newtimestamp = javaTime * 1000000 + (eventTimestamp - nanoTime);
        return newtimestamp;
    }
}