Accesing the Microsecond system timer

Greetings.
I'm currently using a Timer timer to create Events which I use to create FPS (frames per second) in a game. However, it appers that the Java Timer class has the same limitations as MFC, which is that the timer can only go to something like 55 Milliseconds, even tho it lets you set it as low as 1 ms.
Even if I could set my timer to 1 ms and have it cause events that fast, I'm not sure if that would be fast enough, so I'd like to get ahold of the microsecond system timer like is possible in C++.
Want to know if this is even possible, and how if it is.
Thanks

Ok, got the system timer thing figured out. Using the JMK and SystemTimeBase.getNanoseconds(), I can get ahold of a long: 999494375000000000
Which is obviously too long to fit in a long, which the compiler is quick to remind me. And I'm not sure how to get it into a long because simply dividing doesn't work.
can't seem to get it into a string or just ahold of part of it (preferrably the beginning) or anything.
So, if there's a nice way to do this that would be great!
And while we're at it... is there a way to get ahold of the system frequency, like with Win32 QueryPerformanceFrequency ( as quoted in previous reply to my previous post, thanks!).
Thanks!

Similar Messages

  • How to compare the current system time with two timing?

    want to get the current system time and compare with the two different timing example startwindow time as 2:00:00AM and endWindowTime as 6:00:00AM. if my current system time falls between these window i have to execute my rest of the code.
    my below code works for fine for JAVA 1.6 version when i do the same code with JAVA 1.4 i am getting different date and time
    String starTime=(String) NightlyvendorStatus[0].getPropertyValue("startTime");
      String endTime=(String) NightlyvendorStatus[0].getPropertyValue("endTime");
      Date windowStarttime = new SimpleDateFormat("HH:mm:ss").parse(starTime);
      Date windowEndtime = new SimpleDateFormat("HH:mm:ss").parse(endTime);
      Date systemdate = new Date();
      SimpleDateFormat parser = new SimpleDateFormat("HH:mm:ss");
      String systemTime=parser.format(systemdate);
      Date currentTime = new SimpleDateFormat("HH:mm:ss").parse(systemTime);
      if (currentTime.after(windowStarttime) && currentTime.before(windowEndtime)){
    --- rest logic here---}
    the output from JAVA 1.4 IS Thu Jan 01 02:00:00 GMT 1970 Thu Jan 01 06:00:00 GMT 1970 Thu Jan 01 03:23:00 GMT 1970
    HOW TO DO this logic..

    Hi,
    You can try converting dates into timestamp and compare just like as comparing two integers variables.
    Regards,
    Anshul

  • How cost;ly it is to get the current system time

    I am using this call "System.currentTimeMillis()" to get the current system time. I need to now how costly it is to get the current system time.

    Why don't you time it -:) Run it 10000 times and print the first and last result. The difference is the time it took.

  • CALCULATE 6 MINS FROM THE CURRENT SYSTEM TIME....................?

    Hi
    I want to subtract few mins (say 5 min , 10 min ,15 mins , max to 55 mins) from the current system time,
    ex-current time 00:40:00
    Subtract 5 mins(means 5 mins backward)
    Final time 00:35:00
    ex-current time 01:20:00
    Subtract 30 mins(means 30 mins backward)
    Final time 00:50:00
    Pls help me with this with a appropriate logic or FM..
    Thanks a lot in advance
    Basic Date and Time questions are not allowed. They have been answered umpteen times. Please search for them.
    Edited by: kishan P on Sep 1, 2010 12:05 PM
    Edited by: Matt on Sep 1, 2010 9:01 AM - And please do not post in ALL CAPITALS

    May be you can do something like this!
    data: l_time like sy-uzeit.
    data: l_time1 like sy-uzeit value '06'. "6 hrs to be deducted from system time
    move sy-uzeit to l_time. "this is system time
    "write l_time.
    "write:/ l_time1.
    SUBTRACT l_time1 from l_time.
    write:/ l_time. "This is 6 hrs behind system time
    Rajasekhar

  • CALCULATE 6 HOURS FROM THE CURRENT SYSTEM TIME....................?

    hi
    good
    i want to subtract 6 hours from the current system time,
    ex-current time 17.07
    Subtract 6 hours(means 6 hours backward)
    Final time 11.07
    Pls help me with this with a appropriate logic.
    Thanks a lot in advance
    mrutyun^

    May be you can do something like this!
    data: l_time like sy-uzeit.
    data: l_time1 like sy-uzeit value '06'. "6 hrs to be deducted from system time
    move sy-uzeit to l_time. "this is system time
    "write l_time.
    "write:/ l_time1.
    SUBTRACT l_time1 from l_time.
    write:/ l_time. "This is 6 hrs behind system time
    Rajasekhar

  • How do i plot with the operating system time in one plot and show lines between cursors in another using the same XY graph?

    I am having some trouble graphing two plots at once. One plot is to show the current temperature inside a chamber as a function of time. I am trying to pick the current time and temperature each second and plot it with each point being connected by a line. I am able to show a moving, blinking dot each second but I can't figure out how to develop an actual line with these dots. To make matters worse, the blinking dot is back in the year 1903. I understand that it uses seconds elapsed since 1903, and am trying to find out how to graph the current temperature with the system time.
    The second plot is just 5 moveable cursors that are to be connected by a line. I am able to move the cursors and retrieve the position information, but I can't make a line between them.
    I have attached my main .vi, though you may have to pick the graphing part off to have it work for you.
    Attachments:
    Main Module Chamber Testing I_O every 30 sec.vi ‏288 KB

    You're not creating the XY graph data correctly. I've attached an example with a couple of simple XY Graphs. One is using a couple of shift registers to hold the spearate x and y arrays. I think this is what you were trying to do. The other one uses a VI from the shipping examples called XY Chart. It makes an XY Grpah act like a chart. I've also shown the correct way to display current time.Message Edited by Dennis Knutson on 05-12-2005 03:51 PM
    Attachments:
    XY Graph.vi ‏41 KB

  • Get the target system time in the message mapping

    Hi there,
    I need to use the system time of target R/3 system in the message mapping. Any ideas how can I handle this?
    Thanks,
    Igor.

    Thanks for your quick replies.
    XI and R/3 system is in the same timezone but this is not relevant. I know it might sound strange but there is a reason I need to use time in the message mapping which is 2 minutes later than in the target system:
    e.g. target system time: 16:58:32 I need to use 16:56:32 value  in the mapping.
    I found RFC MSS_GET_SY_DATE_TIME which can proide me with the value, just wondering if there is no other way how to do that other than RFC lookup ...
    Thanks,
    Igor

  • Re: incrementing the current system time with 30 minutes

    hi
    in JSPinner i need to display the time but that time should be 30 min greater than system time
    is that possible
    reg
    vino

    1. Create a GregorianCalendar instance
    2. Use roll() to add 30 minutes
    3. Use getTime() to convert to a Date instance

  • Suppose the loads are running in BW, but the BW & System Times are differe

    BW system time is greater than the R/3 system, how we can ensure wether the loads are uploaded into BW System?

    Hi...........
    Look..............While loading data From R/3 to BW............first Extraction will start...........ie the Extraction Job..............if u copy the Request no from the Header tab of the IP Monitor...............then go to the Source System ..........SM37 >> Put the Request no with BI as prefix..............there u can see the Status of the Extraction Job...........
    Now if u r in BW............then U hav different options.......
    PSA and Data Targets/InfoObjects in Parallel >> A process is started to write the data from this data packet into the PSA for each data package. If the data is successfully updated in the PSA, a second parallel process is started. In this process, the transfer rules are used for the package data records, data is adopted by the communication structure, and it is finally written to the data targets. Posting of the data occurs in parallel by packet...................This method is used to update data into the PSA and the data targets with a high level of performance. The BW system receives the data from the source system, writes it to the PSA, and starts the update immediately and in parallel into the corresponding data target............
    In this case Extraction and Loading to the Target will complete parallely.....................when the Technical status will be green..and the Extraction node and the Processing node both will be green............at that time u will understand that load got completed..............
    PSA and Then into Data Target/InfoObject >>A process that writes the package to the PSA table is started for each data package. When the data has been successfully updated to the PSA, the same process then writes the data to the data targets.  Posting of the data occurs in serial by packet.
    In This case first the Extraction Job will get completed.............ie the Extraction node will be Green..........at that time Data Packets will be Yellow...........After some time all data packets will green..............Technical status will be green.along with the data paclets..............it means load completed............
    Only PSA >> Using this method, data is written to the PSA and is not updated any further. In this two seperate Background JObs will be created...............First the Extraction Job will completed.............then the Technical status will be green............then a new JOb will Start to push from PSA to data target............After Loading till PSA...............if u go to the Status tab..............there u will find Processs Manually tab............if u click there update to Target will start..........then Tecxhnical status will again be yellow................after update to the Target get completed....................Technical status will aagain be Green.............
    Now if u r in BI 7.0...................Then infopackage will loaddata till PSA.............u can monitor the Extraction job............Then u hav to Excute DTP to load from PSA to the target..............In the DTP monitor u will find the DTP request............in the SM#& in BI side...............u can monitor this Job.............
    Hope this helps.........
    Regards,
    Debjani........

  • 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 create a type of 'alarm event' based on acquired sensor data and system time?

    Hello all,
    I'm fairly new to LabVIEW and have successfully created a VI that reads voltage data from sensors.  Each sensor outputs 2 voltage values and I treat these values as 2 different DBL values.  I'd like to be able to record each voltage value as a base and then compare the subsequent data readings with that base.  Once the base is determined, I'd like a sort of 'variable' set as "TIME" to be recorded at the moment the base voltage is recorded.
    The alarm should occur (or anything Boolean set to TRUE I guess) once the continuously read voltage remains within certain limits for about 2 hours.  I know I can compare the system time w/ the "TIME" that the voltage base value was recorded.  If the voltage readings escape those limits, I'd like the voltage base value reset and the TIME set to the corresponding system time again.
    I apologize in advance if this I haven't' described my problem well, but if anyone could help me figure out the best way to create this code, I would appreciate it much!
    Thanks!
    Solved!
    Go to Solution.

    ill try to illustrate a couple scenarios:
    keep in mind that i dont necessarily want the voltages in these specific ranges, but just a range of +/- 20 mV ... in an above post i refer to a "base" voltage reading, in this case that would be 200 mV for V1 and 400 mV for V2, just because the voltage has shifted to those values for an extended amount of time each (> 2 seconds)
    Scenario 1
    1:00 pm
    Sensor readings
    Voltage 1: 200 mV
    Voltage 2: 400 mV
    between 1:00 and 3:00 pm:
    Voltage 1 does not deviate from 180-220 mV range
    Voltage 2 does not deviate from 380-420 mV range
    at 3:00pm I want an alert/alarm/Boolean to change to 'true'
    Scenario 2
    1:00 pm
    Sensor readings
    Voltage 1: 200 mV
    Voltage 2: 400 mV
    at 1:45 pm:
    Voltage 1: 2 mV
    Voltage 2: 600 mV
    Since the voltage has shifted out of the range, i want the new base voltage to equal whatever it changed to out of the range, and also the time spent within the new range (2 +/- 20 mV and 600 +/- 20 mV, respectively for V1 and V2) would be reset, so a new 2-hour counter would begin

  • How to get system time from cRIO?

    Hello,
    I have an NI cRIO-9076 chassis with an NI-9467 GPS module and an NI-9234 module.
    I've downloaded the FPGA Timekeeper application which synchronises the FPGA clock to the 1PPS GPS, this works well.  What I want to do is create a trigger that at a pre-defined HH:MMS the system will start to acquire and log data from the Accelerometers connected to the NI-9234 module.
    I have added the controls for the entry of the HH:MMS and calculated the time in seconds.  I would like to compare the system clock once it is locked to the entered timestamp and then trigger.
    As I only have a value that represents seconds in the day I need to calculate the offset from EPOCH to compare against the GPS time reference.  I have read that the NI system clock runs from 01/01/1904 instead of the EPOCH 01/01/1970.
    The question is how do I get the current system time so that I can compare it against the entered time?  I only need seconds in the day = (HH * 3600) + (MM * 60) + (SS)
    Thank you,
    Kind Regards,
    Simon

    You should use the Get Date/Time in Seconds VI which will return a timestamp. You can then format this timestamp using the Format Date/Time String to give you exactly the time format that you need. Then you can extract the numbers you need and do your math.
    www.movimed.com - Custom Imaging Solutions
    Attachments:
    Get Seconds in Day.vi ‏9 KB

  • How to initialize System time?

    Hello everybody.
    I'm working with a Siemens TC65.
    I work without battery. When I supply the module, I get from System.currentTimeMillis() this value: 1009843232546, which I think corresponds to Tue Jan 01 00:00:32 UTC 2002.
    Obviously, I wish to set the correct system time.
    Does anybody knows how to set the system time?
    Thanks in advance.
    Message was edited by:
    Jordi_E

    I am experiencing the exact same problem. I am synchronising
    my time with an sntp server and setting the tc65 system time
    with AT+CCLK.
    Unfortunately System.currentTimeMillis() is still showing the old time,
    even after waiting up to 10s after AT+CCLK. So how do I get it to show
    the new correct time?
    Problem is I cannot restart the module everytime the time is set because
    I need to listen to incoming data.
    Any suggestion would be really helpful. Thanks

  • Running System Time In JFrame

    import javax.swing.*;
    import java.awt.*;
    public class SystemTime{
    public static void main(String[] args) {
    JFrame win = new JFrame("System Time");
    Container contPane = win.getContentPane();
    contPane.setBackground(Color.blue);
    BorderLayout layM = new BorderLayout();
    layM.setHgap(5);
    layM.setVgap(5);
    contPane.setLayout(layM);
    JTextArea tA = new JTextArea(10, 28);
    tA.setText(" The Current system time is:");
    JScrollPane scrollP = new JScrollPane(tA);
    scrollP.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); scrollP.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); contPane.add(scrollP, BorderLayout.CENTER);
    JLabel nLab = new JLabel("The Time is updated every 3 seconds");
    nLab.setHorizontalAlignment(JLabel.CENTER);
    nLab.setOpaque(true);
    nLab.setBackground(Color.green);
    contPane.add(nLab, BorderLayout.NORTH);
    JLabel sLab = new JLabel("Use the scrollbar to go to the latest entry");
    sLab.setHorizontalAlignment(JLabel.CENTER);
    sLab.setOpaque(true);
    sLab.setBackground(Color.green);
    contPane.add(sLab, BorderLayout.SOUTH);
    win.pack();
    win.setVisible(true);
    public class TimerTest {
    public static void main(String[] args){
    String s1;
    TimeData t1;
    for (int counter = 1; counter >= 5; counter++) {
    t1 = new TimeData(System.currentTimeMillis());
    s1 = t1.toTimeString();
    System.out.println(s1);
    if (counter != 5) Timer.pause(3);
    // You don't want to wait at the
    // end of last iteration
    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; }
    code}
    All the code compile and run OK. I am trying to put the System Time in the JFrame and run as an infiniate loop.  I manged to use the for loop. I need to have the Time In the Jframe.
    as in TimerTest application.  Timedata give the output in hours: minutes: seconds.
    Please can you assist in solving this problem.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    is there a reason for the 'long-hand' approach
    import javax.swing.*;
    import java.awt.*;
    class SystemTime{
      public static void main(String[] args){
        final java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("HH:mm:ss");
        final JFrame win = new JFrame(sdf.format(new java.util.Date()));
        win.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        win.setSize(200,100);
        win.setLocationRelativeTo(null);
        win.setVisible(true);
        new javax.swing.Timer(1000,new java.awt.event.ActionListener(){
          public void actionPerformed(java.awt.event.ActionEvent ae){
            win.setTitle(sdf.format(new java.util.Date()));
        }).start();
    }

  • BPM: How to capture Webservice system Time

    Dear friends,
    I  have one Sybchrounous Interface as follows :
    Local PI folder -
    >PI -
    > Webservice system
                                 ( Sync Interface )
    Overall flow:
    1.        PI Picks up the Control file consisting of date& time, count and start fields from PI folder.
    2.        PI mapping converts the file to soap request message and sends it to Web Service
    3.        PI receives the response soap message from web service converts into an XML file and places in the PI folder.
    4.        The loop continues in PI BPM until all the records of particular time period are retrieved.
    Logic in Detail:
    5.     The initial request file consists of a user defined time stamp (since), count and start values to retrieve the initial load.
    6.     PI BPM sends this request in a synchronous mode to Web service and gets the response back.
    7.     Apart from the device details, the response message from WS consists of u2018current_timeu2019 field which is the current  system  time of webservice when the query is executed on the web service System.
    8.     BPM has to capture this field during first iteration and updates the source request message field u2018sinceu2019 with the web      service system time.
    9.      From next cycle, PI picks up the file which consists of WB service system time in the u2018sinceu2019 field.
    10   BPM continues in loop until all the records are fetched from web service and writes the files with time stamp concatenated to the PI folder.
    Bottlenecks:
    Tried to implement with BPM ..But facing problems to implement point 4 ,8 and 10 .
    Kindly guide  me how we can design this interface .
    Renu.

    Dear friends,
    I  have one Sybchrounous Interface as follows :
    Local PI folder -
    >PI -
    > Webservice system
                                 ( Sync Interface )
    Overall flow:
    1.        PI Picks up the Control file consisting of date& time, count and start fields from PI folder.
    2.        PI mapping converts the file to soap request message and sends it to Web Service
    3.        PI receives the response soap message from web service converts into an XML file and places in the PI folder.
    4.        The loop continues in PI BPM until all the records of particular time period are retrieved.
    Logic in Detail:
    5.     The initial request file consists of a user defined time stamp (since), count and start values to retrieve the initial load.
    6.     PI BPM sends this request in a synchronous mode to Web service and gets the response back.
    7.     Apart from the device details, the response message from WS consists of u2018current_timeu2019 field which is the current  system  time of webservice when the query is executed on the web service System.
    8.     BPM has to capture this field during first iteration and updates the source request message field u2018sinceu2019 with the web      service system time.
    9.      From next cycle, PI picks up the file which consists of WB service system time in the u2018sinceu2019 field.
    10   BPM continues in loop until all the records are fetched from web service and writes the files with time stamp concatenated to the PI folder.
    Bottlenecks:
    Tried to implement with BPM ..But facing problems to implement point 4 ,8 and 10 .
    Kindly guide  me how we can design this interface .
    Renu.

Maybe you are looking for

  • Max resolution connecting to dell monitor

    i am dumb so please pretend i'm your mom trying to set this up and asking the Q .  i have a 3 yr old dell 24" (DVI/VGA) monitor and i'd like to connect my 13" MBP to it.  i bought the 'mini displayport to DVI adapter' for my mbp and have connected to

  • Problem Importing a PDF into Indesign CC

    We don't usually have this problem with InDesign CC, but this came at a very bad time and I'm not sure if it is a bug in InDesign CC or not. We were given a PDF from an auditor of a client to bring into their financial report. The strange thing is th

  • 9.3.0

    When using the "Repair Adobe Reader Installation" , I receive ""The Windows Installer Service can not be accessed" Is this a glitch in 9.3.0? Service people who whave checked the machine claim nothing is wrong. Using Vista Home Addition 32 bit. Sugge

  • Apple just said I was selected today as a random winner and I have an option to win a free iPad air 2 or an iphone6. Is this real?

    Apple just said I was selected today as a random winner and I have an option to win a free iPad air 2 or an iphone6. Is this real?

  • RMAN Error - restore database validate

    Hi all I am trying to validate a full database backup taken on tape using 'restore database validate' command but for some reason this command spits out multi-page long PL/SQL code (below truncated output). I have searched all over for a solution but