Getting accurate System time to milliseconds

I have written a program which needs to do following two things
1. make current thread sleep by some value in range 1 to 100 milliseconds
2. Get current system, acurate to maximum accurate value in miliseconds
as Java on Windows does not gurantee that Thread will sleep for the specified milliseconds and system time is also approximate, I need a solution that provides the guranteed accuracy for above two cases.
Please help!!!
Thanks in advance

I have created a udp client/server. I am able to regulate the rate of packets (approx) on server, but the client time is shifting(slowing down).
The basic function of client is to put set a variable client recieve time to the time on client and send packet back to server (to calculate delay on n/w).
The server is sending data at correct timing (approximate), but the recieve time at client is shifting down slowly.
I reduced the load on client by just discarding currrent packet and goto recieve next, but the delay is still there.
The data captured is this (SS is Server Send time, CR is Client Recieve time)
SS: 1108653459464 CR: 1108653447161
SS: 1108653460464 CR: 1108653448161
SS: 1108653461464 CR: 1108653449161
SS: 1108653462464 CR: 1108653450161
SS: 1108653463464 CR: 1108653451161
SS: 1108653464464 CR: 1108653452161
SS: 1108653465464 CR: 1108653453160
SS: 1108653466464 CR: 1108653454160
SS: 1108653467464 CR: 1108653455160
SS: 1108653468464 CR: 1108653456160
SS: 1108653469464 CR: 1108653457160
SS: 1108653470464 CR: 1108653458160
SS: 1108653471463 CR: 1108653459160
SS: 1108653472479 CR: 1108653460145
SS: 1108653473463 CR: 1108653461129
// server time reduced by just 1 millisecond but client got mad
SS: 1108653474463 CR: 1108653462129
SS: 1108653475463 CR: 1108653463129
SS: 1108653476463 CR: 1108653464129
SS: 1108653477463 CR: 1108653465129
SS: 1108653478463 CR: 1108653466145
SS: 1108653479463 CR: 1108653467145
SS: 1108653480479 CR: 1108653468145
SS: 1108653481463 CR: 1108653469129
SS: 1108653482463 CR: 1108653470129
SS: 1108653483463 CR: 1108653471129
SS: 1108653484463 CR: 1108653472129
SS: 1108653485463 CR: 1108653473129
SS: 1108653486463 CR: 1108653474129
SS: 1108653487463 CR: 1108653475129
SS: 1108653488479 CR: 1108653476129
SS: 1108653489463 CR: 1108653477113
SS: 1108653490463 CR: 1108653478129
SS: 1108653491463 CR: 1108653479129
SS: 1108653492463 CR: 1108653480129

Similar Messages

  • 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

  • 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

  • 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.

  • How to get printers system time&

    Hi all! 
    I need to get my printer's system time, cat you help me? May be somebody knows how do this?

    Hi Lexabb,
    Thanks for the reply.
    The printer you have is actually a commercial printer and this is a consumer printer forum.
    To get better assistance with your LaserJet 700 m712, I will suggest that you post this question on the commercial forums by clicking the following link: Printers - LaserJet, as you should be able to get better assistance for your commercial printer there
    Please click “Accept as Solution ” if you feel my post resolved your issue, as it will help others find the solution faster
    Click the “Kudos Thumbs Up" on the right to say “Thanks” for helping!
    **MissTeriLynn**
    I work on behalf of HP

  • What SAP function is used to get current system time?

    Hello All:
        I heard there is an SAP function to get system time. It was "gettime" or something! Could anyone please tell me what the function is?
    Thanks.
    Mithun

    Like this:
    DATA tt TYPE uzeit.
    GET TIME FIELD tt.
    This will reset sy-uzeit as well.
    Hmm... it appears I am mistaken. SY-UZEIT always seems to have the current time. I think this is a change from earlier releases.
    Rob
    Message was edited by:
            Rob Burbank

  • 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

  • How to fetch current system time in milliseconds using AppleScript?

    I need to write the actual systemtime hh:mm:ss.msc into a field of FileMaker by using AppleScript (as FileMaker does still not support TimeStamps down to milli seconds) - now, how to realize that?
    Any help is welcome - Thanx

    Hi Mathur,
    kindly help me in mapping a field in which I have to map current system time.
    I think there is no standard function for time like the date so do i write a UDF for the same or any other way an in case a UDF than please help in that.
    Mathur no need to write UDF for that..
    Use standard function Current date-------> In that (Target Format) u have to specify the time i.e: HHmmss
    Thats it..... Noe use this function as u like...
    Satya Kumar

  • Where do the UCS blades get their system time from?

    Hello,
    I'm curious how the system clock gets set on UCS blades?
    I have NTP setup in UCSM and expected the blades to set their time based on that during first boot at the very least.
    I recently associated a new service profile to a blade and installed ESXi5.  The VMware 60 grace license period showed the correct expiry date (04/07/2012) but as soon as I would connect with the vSphere client it would say grace period ended.  After digging a bit the blade had a date set for someday in 2010?  Anyone know why this would be the case and how I can set the blade system clock?
    -Brian

    Found a bug to track this issue CSCtj19497.  There's no commit date yet, but I'm going to get some pressure put on this one.
    I encourage you to open a quick TAC case and simply request to have this bug attached to your SR.  This will give more ammunition to get this resolved faster.
    Regards,
    Robert

  • Q: How to get local time in milliseconds?

    Hi,
    As we know, Labview a G function which can get local date/time in
    seconds. Is there any way to get local date/time in milliseconds? Or it
    also helps if you know there is any similiar function in C/C++.
    Thanks!
    G. Chen
    Ph.D. Candidate
    Ohio Univeristy, Athens, OH
    Nothing can dim the light which shines from within.
    Sent via Deja.com http://www.deja.com/
    Before you buy.

    > As we know, Labview a G function which can get local date/time in
    > seconds. Is there any way to get local date/time in milliseconds? Or it
    > also helps if you know there is any similiar function in C/C++.
    >
    The local time function returns a double precision number.
    Depending on the platform you are using, the number returned
    may have a subsecond amount. This means that you subtract
    and multiply by 1000 to get ms. The platform that returns
    this is Win32, and its resolution is 55ms. Other platforms
    will always return 0.
    It is also sort of possible to synch the ms function with
    the local time function, but this is not very accurate.
    It involves watching the local time function in a loop
    until it changes, and also sample the ms clock to synchronize
    the two clocks.
    From that point on, you can use the ms
    function exclusively, and do the math to get back to local
    time. The problem with this is that the fast clock rolls over
    about every 40 days, the clock may have some drift with the
    local clock, and then there is daylight saving time and time
    zone math, which is always surprisingly complex.
    Greg McKaskle

  • To get system time in AM PM

    HI
    I have used sy-uzeit to get the  system time but i want the time to displayed in AM or PM
    for eg:     02:30:56 PM
    Can anybody please suggest how to do this..

    Hi.,
    You have to do it manually by code.,  try this.,
    DATA: time TYPE string,
          hrs type char10.
    time = sy-uzeit.
    IF time+0(2) ge 12.
      hrs = time+0(2) - 12.
      CONCATENATE hrs time2(2) time4(2)  INTO time SEPARATED BY ':'.
      CONCATENATE time 'PM' INTO time SEPARATED BY ''.
    ELSE.
      CONCATENATE time0(2) time2(2) time+4(2)  INTO time SEPARATED BY ':'.
      CONCATENATE time 'AM' INTO time SEPARATED BY ''.
    ENDIF.
    WRITE time.
    hope this helps u.,
    Thanks & Regards,
    Kiran

  • Get system time

    How can i get a system time ?
    and transfer to a specify format like this , "yyyymmddhhmmss" ?

    Hi,
    I think a gettime function has been included in the built in fuctions. You can check this by using the Statement step type and using the browse button on the edit expression dialog.
    Regards
    Ray Farmer
    Regards
    Ray Farmer

  • Getting system time

    hi
    Can anyone plz tell me how to get the system time in a java program.
    I wanted to create a time logger of a java program, with the enty time and exit time details.
    Actually I wanted to find the time taken by the program to complete the execution and create a file with the time details(time_logger.txt) . ie the entry time of the program and exit time of the program.
    can anyone help me with this.
    thnkx in advance.

    Or
    long start = System.nanoTime();Generally if you're trying to time your code you should wrap it in 2 calls of System.nanoTime() or System.currentTimeMillis(), a bit like this;
    long start = System.nanoTime();
    ....//your code
    long end = System.nanoTime() - start; //total time taken to execute your code.Edited by: FTAYLOR on 10-Apr-2008 11:40

Maybe you are looking for

  • Problem with hp photo creations

    Hi! i'm trying to use the premium settings and the program is keeping showing me the window to registrer or sign in (i alredy bought this function). My emal is [Personal Information Removed]

  • Level 1 Notification Not working on Folder Emails.

    Hello Everyone I am in a strange situation where my Level 1 Notification doesnt work. Not working. 1. If there is an email which comes into my inbox and if there is a rule which is set on my Lotus Domino (Desktop) to save a copy in lets says XYZ fold

  • How to select number field starting with 99

    Hi Freinds- I have to pick values for a number field  but  i want only those values which starting with 99  how i can put code in select query for this ? Regards Meeta & Ruby

  • 1D Array of Cluster of 2 Elements Write to Spreadshee​t

    Hi all, first time using LabView in many years.  I am trying to write a VI that will acquire data from our cDAQ (right now just trying to get it to work with a single thermocouple in a NI 9211, but eventually will be 8 X thermocouple, 4 X pressure tr

  • Mac pro lion froze in words 2008

    mac book pro lion 10.8.2 froze in words 2008 need help please