I need to get the system time in Micro second

Hi,
In the java API there is a static method �curentTimeMillis�, but I need
to get the system time in Micro second there is a equivalent method? Or
there exists any suggested solution?
Thanks
Dany

Why do you need such accurate timing ?
I'd be suprised if anyone seriously relies on millisecond timing in
Java, never mind calling through to JNI to get microsecond timing.
If that's even possible in native code.
The garbage collector can cause delays/pauses in a java program and
throw timings off by at least 500 milliseconds, probably more under big loads.
If you just want a more accuruate way to reset a random seed, there's probably other ways...
regards,
Owen

Similar Messages

  • How can i get the System Time from the other host

    I want to get the System Time from the other host in the LAN,How can I get the Time using Java.
    Such as I am in WIN 2000 and I have a Unix host in LAN, I want to get unix host System time, How can I do it.

    Open a socket to port 13 and read a string with the time.
    -or-
    Open a socket to port 27 and read 4 bytes that are a network order timestamp
    Assuming that your UNIX machine has those services running, most do

  • How to get the system time in a Swing application ?

    I know how to do it in JavaScript, but not java. Please help me, and also how to get the system time in an Applet. Thanks !!!

    Check this link, I hope it helps
    http://202.71.136.142:8080/globalleafs/Swing/View.jsp?slno=22&tbl=0

  • Function Module for getting the System time.

    Hello All,
    Which is the Function Module used in APO to get the system time?
    Thanks for your response in advance.
    Regards, Chirag

    Hi Chirag,
    Please try the following function modules
    1) /SAPAPO/CRES_GET_TIMESTREAM_BT
    2) /SAPAPO/OM_TIME_GET
    The field name for system time is UZEIT under
    structure SYST
    Also try
    3) CALENDAR_GET_TIMESTAMP
    4) SAL_CSM_RECEIVER
    I guess the third one will have your required data
    Regards
    R. Senthil Mareeswaran.

  • Need to get the exact time of each picture that I saved ( maybe as a excel sheet or word )

    Hi guys,
    I am actually a new labview user. I have successfullly been able to save pictures. But unfortunately I got two problems. The first one is that I need to use two cameras at the same time. The program I have so far is for one camera. The second problem is that I need to get the exact time for each picture saved in the profile.
    I would appreciate if someone can help me with that. Anyway plz find attached the subvi.
    Regards,
    Abbas
    Attachments:
    Abbas progress.vi ‏54 KB

    Hi Abbas,
    First, I notice that you are using IMAQ for USB.  Is there any particular reason you are not using IMAQdx?  This is the newer, supported driver for use with USB cameras that supports acquiring from multiple cameras at the same time. 
    Check these two articles:
    Can I Acquire from Multiple USB Cameras Simultaneously Using IMAQdx?
    Can I Acquire from Two USB Cameras Simultaneously with NI-IMAQ for USB Cameras 1.0?
    And also this example (if you camera does not support acquiring from multiple cameras at the same time):
    Toggle Between Multiple USB Cameras
    As for timestamps, some cameras output them with the frame timing.  However, usually this is not a feature of USB cameras; if it is not, you can look into timing options within LabVIEW.  Try playing with the property node for IMAQdx and the Acquisition Attributes.
    Cheers,
    Marti C
    Applications Engineer
    National Instruments
    NI Medical

  • To get the system time in milliseconds

    i want to get the system time in milliseconds
    eventhough the MLS(milliseconds) is given in the select statement as follows,
    sql>select to_char(sysdate,'MON:DD:YYYY.HH:HH:MI:SS:MLS') "NOW" from dual;
    does not seem to work.
    it throws the error that
    ORA-01821: date format not recognized
    please give a solution
    thanks in advance
    null

    Hi,
    Yes, any of Oracle tools could not provide the milliseconds.
    Then why cant not use external procedures (RPC) and get a time string from OS.
    These are steps:
    1. Create a C shared library.
    (Some times U have to go for OCI programs.)
    Milliseconds provision is there in C. ( use tm struct). Make a string as ur format by using any string functions in C or sprintf(). By using return, return this string.
    Here error may come, if u are using pure C. Better to go for OCI call back methods.
    2. Create oracle library and attach this shared libary with it.
    3. Create external procedure/function and connect this.
    If u want code, I can post it here.
    with regards,
    Boby Jose Thekkanth,
    Dharma Computers(P) Ltd.
    Bangalore-India.
    www.dharma.com.
    null

  • The system time is val seconds older than the queue space time

    We did a time change on our system to future time and getting the above error after we are trying to reboot the application with current time.
    Please help !

    The Tuxedo queueing subsystem access to an accurate system time in order to
    implement message expiration times and other time-related features. If the
    system time is reset to an earlier value, time related queueing features can
    work incorrectly. For this reason,
    Q_CAT:2238 is logged if such a situation is encountered. Timestamps can be
    stored within individual /Q messages as well as in the queuespace
    superblock.
    If the time change into the future was of short duration, the easiest way to
    resolve this problem is simply to wait until the real time reaches the
    previously set future time. Once this happens, the queuespace will once
    again be usable.
    If the queuespace is used on a test system and the data on it is not
    valuable, another option is to recreate the queue space from scratch.
    Another option is to reset the system time back to the previous future time
    in order to use the queuespace.
    If this is a production system and you are a BEA support customer, you can
    file a support case about this situation. It may be possible for support to
    write a utility program to modify the timestamps within the queue to earlier
    values or to give you a version of /Q compiled to accept an environment
    variable that can be used to modify /Q's idea of the system time.
    Ed
    <hunki> wrote in message news:[email protected]..
    We did a time change on our system to future time and getting the above
    error after we are trying to reboot the application with current time.
    Please help !

  • How to get the system time(hh:mm:ss) in jspx file itself.

    Hi I'm using jdeveloper 11.1.1.3.0.
    I am having one transient attribute in VO (data type is Timestamp and format is hh:mm:ss) and created the data control. Now I am drag and drop that attribute in one jspx file itself. if i run that page mean i need the current system time as a output. it ll automatically run in the output page(like digital clock - HH:MM:SS). how to implement this one plz help me sir.

    Hi john
    I got the output using the poll operation in the jspx file. But the mouse pointer is also updated(arrow mark and round alternatively). so how to stop the mouse pointer update.
    Regards
    Ragu

  • Accuracy of checking the system time -- how many ms?

    I'm creating a program for a university lab which will display a number of reading and comprehension tests to middleschoolers.
    For most of the tests, I need a fairly accurate measure of reaction times, preferably within about 1-5 milliseconds.
    In my program, I
    1) Display a stimulus
    2) Get the start time, using System.currentTimeMillis();
    3) Wait for the user to press a button
    4) Get end time, using System.currentTimeMillis();
    I will be displaying these in public schools, which may be using Win XP, 2000, 95, or Mac OS X.
    1) How accurate can I expect the System.currentTimeMillis(); to be? Is there any delay between the user hitting a button and formKeyPressed(KeyEvent evt) being called?
    2) Is there any way to test the accuracy of a computer from within the program? Is it possible that a seven-year-old computer would introduce inaccuracies of over, say, 5 ms?
    Thanks for any help regarding these questions.

    I'm creating a program for a university lab which
    will display a number of reading and comprehension
    tests to middleschoolers.
    For most of the tests, I need a fairly accurate
    measure of reaction times, preferably within about
    1-5 milliseconds.
    Uh-oh.
    In my program, I
    1) Display a stimulus
    2) Get the start time, using
    System.currentTimeMillis();
    3) Wait for the user to press a button
    4) Get end time, using System.currentTimeMillis();
    I will be displaying these in public schools, which
    may be using Win XP, 2000, 95, or Mac OS X.
    1) How accurate can I expect the
    System.currentTimeMillis(); to be? For Windows at least 10 ms. Maybe more or less depending on mileage.
    Is there any delay
    between the user hitting a button and
    formKeyPressed(KeyEvent evt) being called?
    There are some Windows related bugs in getting the system time that can throw the whole thing into some chaos as well.
    2) Is there any way to test the accuracy of a
    computer from within the program? Sorry what? Anyway like I said repeated system time calls on Windows will do funny things to the clock (like accelerate it). This is a Windows bug on some versions (if not all) of what you mentioned.

  • To get the current time

    Hi All,
    I wanted to know if there is anything like getcurrtime() in JAVA to get the current time.
    Right now what i am doing is creating a new Date object and then calling getTime() on that new object.
    One more question. when you call the getTime() function on an object does it give the time of creating of the object or the current
    time.
    Thanks in advance,
    Amitabh

    Hi All,
    I wanted to know if there is anything like
    getcurrtime() in JAVA to get the current time.
    Right now what i am doing is creating a new Date
    object and then calling getTime() on that new object.
    One more question. when you call the getTime()
    function on an object does it give the time of
    creating of the object or the current
    time.
    Thanks in advance,
    AmitabhHola!
    You can use
    long time = System.currentTimeMillis();
    to get the current time in milli seconds (since 1970) :)
    If you need a formatted String with the time, you can use:
    java.text.DateFormat df = new java.text.SimpleDateFormat("HH:mm:ss"); // "HH:mm:ss", for example
    String formattedTime = df.format(new Date());
    And when you use the method "getTime()", it returns the Date creation time (because the object is initialized to that time when created)
    Hasta pronto!

  • How to get the system date as a session attribute?

    Hi all,
    How can i get the system time and date to a session?
    This is my code:
    String startDate=<How will i get (system date) here?>;
    session.setAttribute("startDate",startDate);
    String startTime=<How will i get (system time + 1hr) here?>;
    session.setAttribute("startTime",startTime);
    Thanks in advance,
    Lakshma

    This is one way:
            Calendar cal = Calendar.getInstance();
            SimpleDateFormat sd1 = new SimpleDateFormat("yyyyMMdd");
            System.out.println(sd1.format(cal.getTime()));
            SimpleDateFormat sd2 = new SimpleDateFormat("hh:mm:ss");
            cal.add(Calendar.HOUR, 1);
            System.out.println(sd2.format(cal.getTime()));

  • Displaying the System Time In a Frame.

    import javax.swing.*;
    public class Window1 {
    public static void main(String[] args) {
    JFrame win = new JFrame("Window1");
    JTextArea Timedata = new JTextArea(10, 30);
    win.getContentPane().add(tA);
    win.pack();
    win.setVisible(true);
    tA.setText ("This is an editable text area");
    public class TimeData {
    private long hours, minutes, seconds;
    public TimeData(long millis) {
    seconds = (millis/1000)%60;
    minutes = (millis/(60*1000))%60;
    hours = (millis/(60*60*1000))%24;
    public String toTimeString() {
    return (String.valueOf(hours) + ":" + String.valueOf(minutes) + ":" + String.valueOf(seconds));
    public long getHours() { return hours; }
    public long getMinutes() { return minutes; }
    public long getSeconds() { return seconds; }
    public class SystemTimeTest {
    public static void main(String[] args) {
    String s1;
    TimeData t1;
    t1 = new TimeData (System.currentTimeMillis());
    s1 = t1.toTimeString();
    System.out.println(s1);
    // How do you get the system time to display in the frame, using the above classes. unable to find the information through books and online tutorials. Please Help.

    In future Swing related questions should be posted into the Swing forum.
    I am not sure what tutorials you are using but they can't be very good if you did this. Try this tutorial instead http://java.sun.com/docs/books/tutorial/uiswing/components/index.html
    And please post some code that might compile without syntax errors next time.
    JTextArea Timedata = new JTextArea(10, 30);
    win.getContentPane().add(tA);There is no tA defined anywhere.

  • How to grab system time in nano seconds?

    Is there any way to grab the system time in nano seconds? Thanks!

    Check out class TimeBase in JMF, it works with nanos.the question about the highresolution timer was posted hundred times! and always there was the anwer "no there is no high resolution timer in javas given". you are the first who points out that there is one! if its really true: congratulations :-)

  • I need to get the Current System Date and time in the format

    I need to get the Current System Date and time in the format
    *6/24/2009 11:30:29 AM*
    How do i do it ?

    I seem to be saying this a lot lately.
    Google is your friend.
    I googled "java current date format" and SimpleDateFormat featured prominently in the results.

  • I can get the last time a patch was applied. What I need is this info for ALL servers.

    Getting the last time a server was patched is a simple, single line of PowerShell:
         get-hotfix -computername seadcweb10 | sort InstalledOn | select -last 1
    What I need is to get a list of *all* the servers in Active Directory, and get this information for each.
    I've tried variations of foreach , but I get errors.
    foreach ( $p in Get-ADComputer -Filter 'OperatingSystem -like "Windows *Server*"' ) { get-hotfix -computername $p.Name | select -last 1 }
    Get-HotFix : The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
    At line:1 char:97
    + foreach ( $p in Get-ADComputer -Filter 'OperatingSystem -like "Windows *Server*"' ) { get-hotfix <<<<  -computername
    $p.Name | select -last 1 }
        + CategoryInfo          : NotSpecified: (:) [Get-HotFix], COMException
        + FullyQualifiedErrorId : System.Runtime.InteropServices.COMException,Microsoft.PowerShell.Commands.GetHotFixCommand
    What am I doing wrong?

    Hi
    The RPC server is unavailable
    This error  comes when any server is not pingable.
    Make sure you are able to ping to all server from the server you are running the script.
    Then give a try to below script :
    foreach ( $p in Get-ADComputer -Filter {OperatingSystem -like "Windows *Server*"})
    get-hotfix -computername $p.Name | select -last 1
    MCITP - Exchange 2010 | MCITP - Windows Server 2008 R2

Maybe you are looking for

  • Purchase price and sales price

    Hi Gurus, for our company I need make configuration that will allow to sell materials for the same prices as it was bought. for example I had 2 PO for the same material, firstly it cost 200 usd and secondly 100 usd. Now I will sell 2 e.a. for 150usd

  • Removing Task from UWL after approval

    HI Gurus I Need to Delete a task in the UWL after approval Scenario: I have developed the mss/pcr adobe forms inthe place of standard adobe forms i have configured the customized adobe forms which i have developed in Webdynpro for Java So in mss/pcr

  • ORA-06550:: while provisioning a workspace request

    Hello all, Using Application Express 3.0.0.00.20 on 10gR2 While trying to provision the request for a worksapce, its throwing this error Its missing a " ) " in the last but 4th line. ORA-06550: line 16, column 86: PLS-00103: Encountered the symbol ";

  • Unintentionally Doubled My Catalog

    Unintentionally Doubled My Catalog For the past week I have attempted to learn PSE 9 Organize and Backup/Sync. It has been an exercise in frustration. Two immediate issues: 1. I had categorized and tagged 8000 items in my catalog - jpeg only. I had a

  • Customizing reports 6i

    Hi, Can one get rid of the default menu/toolbar of reports6i? I'm seeking help if it's possible to customize the report menu/toolbar. Thanks for cooperation. SD