How to get system idle time

Hello Sir,
I am Udhaya. I don't know how to capture system idle time using java. Please any one help me how to get system idle time. Any class is available in java to get idle time?
Thank in advance
Udhaya

jwenting wrote:
DrLaszloJamf wrote:
jwenting wrote:
the moment you ask the system for its idle time that idle time becomes 0, so just returning a constant value of 0 would always yield the correct answer.But when you don't call this constant method the value it would return is wrong. This is the sort of thing that keeps me up at night.Except of course that when you don't call it it doesn't return it and therefore still behaves properly.
Or were you thinking of philosphical problems like "what does a method do when it's not called?"?Actually I was trying to see if I could get the OP to say boo to a goose.

Similar Messages

  • How to get system date and time?

    Can someone show me a code on how to get system date and time.
    Thanks!

    there is one really easy way to get system time, the api gives a great example of code on this. use gregorian calendar, which you'll find in the api under GregorianCalendar. You only need to create one instance of GC, ie Calendar time = new GregorianCalendar();
    you save seconds, minute and hours into int values, so you don't have to access the system time every second, you can create a thread which adds one to the int second value, if oyu see what i mean, for example, i have saved the hours, minutes and seconds as int values;
    int hour, minute, second;
    i can then create a thread (Thread thread = new Thread(this) and run it like:
    Calendar time;
    int hour, minute, second;
    Thread thread = null;
    public MyTime() {
    hour= time.get(Calendar.HOUR_OF_DAY);
    minute = time.get(Calendar.MINUTE);
    second = time.get(Calendar.SECOND);
    if(thread == null) {
    thread = new Thread(this);
    thread.start();
    public void run() {
    Thread t = Thread.currentThread();
    while(thread == t) {
    thread.sleep(1000);
    second++;
    if(second > 59)
    minute++;
    if(minute>59)
    hour++;
    formatTime();
    public void formatTime() {
    second = (second > 59? 0 : second);
    minute = (minute > 59? 0 : minute);
    hour = (hour > 23? 0 : hour);
    System.out.println(hour+":"+minute+":"+second);
    public static void main(String[] args) {
    new MyTime();
    I know this looks like gibberish but it should work. If not, try to fix the problem, i have written from memory really but i guarantee you, this gets the time then every second, simply adds one to the second and then formats time. You can also access the day, month and year then format them using the above code. I don't like giving code since you should really do these things yourself but it is 2:04am, i have nothing better to do and i am not tired so i did you a favour - i have become what i always did not want to, someone ho stays upall night writing code.

  • [ASK] How to get system date and substring / concate in data manager dynami

    Hello guys.
    I want to run package DM with the input have default value.
    The selection is look like this :
    Dimension : CATEGORY
    Source : PLAN_2011
    Destination : FORECAST_2011
    Dimension : TIME
    Source : 2011.JAN,2011.FEB,2011.MAR,2011.APR,2011.MAY,2011.JUN,2011.JUL,2011.AUG,2011.SEP,2011.OCT,2011.NOV,2011.DEC
    Destination : <same>
    How to get system date year and do the substring / concate ?
    So dimension category source will be PLAN_<YYYY>, destination = FORECAST_<YYYY>
    Dimension source = <YYYY>.JAN,<YYYY>.FEB,<YYYY>.MAR,<YYYY>.APR,<YYYY>.MAY,<YYYY>.JUN,<YYYY>.JUL,<YYYY>.AUG,<YYYY>.SEP,<YYYY>.OCT,<YYYY>.NOV,<YYYY>.DEC
    Depend on year system date.
    Thank you.

    Stuart,How are you storing OnSaleDate. If you are using OnSaleDate as an attribute dimension then you can write a Custom Defined Function to either:1- query your system for the current date and return the number of seconds that have elapsed since 1/1/1970. This is by definition the begining of the Epoch and how Essbase treats Attribute Dimensions of the Date type.public static long getDateInSeconds() {           Calendar cal = Calendar.getInstance();           return cal.getTime().getTime()/1000;}2- Write a Custom Defined Function that will accept the OnSaleDate and return the number of days sincepublic static double daysSince(double myDate) {     return (getDateInSeconds()-myDate )/86400;}

  • TRACK SYSTEM IDLE TIME

    Hii Guys,
    I am working on a client server architecture based project named "ATTENDANCE TRACKING SYSTEM".
    For this, I need a java program that can run in background(without any interface) and track system idle time on client machine.
    The idle time is the time elapsed since last key was pressed or since last time mouse was moved(whichever is later).
    So that, i can use the output of that program to track the idle time of the client machine.
    I searched a lot, but everywhere i found to use JNI. But i dont know anything yet about JNI.
    Please help me out...

    Prince_2188 wrote:
    Thanxx 4 ur reply Mr. Jschell
    But the problem here is that i will have to do it in JAVA, as i have been asked by Wipro Technologies to do it in JAVA.Probably not a good idea to name names.
    The requirement is stupid.
    And given that the requirement is not negotiable you might want to review the contract/requirements before going further. Because using JNI is not using java. So what makes you think that that doesn't break the contract?
    >
    On Internet, i found that doing this task purely in JAVA is not possible and i will have to do it using JNI and C++.
    But i dont know how to use JNI and moreover i could not find coding for the same on Internet.
    Secondly, i m not aware of the functions in Windows API that can help me out in this regard....
    Go to a windows site and ask about what API one would use to monitor idle time. Do NOT mention java. Just ask about the windows API.

  • How to get Query response Time?

    II am on BI 7.0. I ran some queries using RSRT command. I want to find how much time the queries took.
    I went to
    st03 -> expert mode -> BI system load-> select today / week/month according to the query runtime day
    I do not see any Info Providers. Query was on a cube so why no Info Providers.
    Does something have to turned on InfoPorvider to show.
    When I look  in RSDDSTAT_OLAP table, I do see many rows but cannot make any sense. Is there some documentation on how to get total  query time from this table?
    Is there any other way to get query response time?
    Thanks a lot.

    HI,
    why not use RSRT ? You can add database statistics option in "Execut & Debug" and you get all the runtime metrics of your query
    In transaction RSRT, enter the query name and press u2018Execute +Debugu2019.
    Selecting u2018Display Statistics Datau2019 .
    After executing the query will return a list of the measured metrics.
    The event id / text describes the steps  (duration in seconds):
    "OLAP: Read data" gives the SQL statements repsonse time (ok - because the SAP
    application server acts as an Oracle client a little network traffic from the db server is included,
    but as far as you not transferring zillions of rows it can be ignored)
    But it gives you much more (i.e. if the OLAP cache gets used or not )...
    In the "Aggreagate statistcs" you get all the infoproviders involved in that query.
    bye
    yk

  • Capture system print event and system idle time

    Hello,
    We are creating a desktop widget using AIR. The widget will be docked to the system tray. What we want to achieve is:
    1. When the user invokes Print function at the OS level, from any location/appolication, the AIR widget shall listen to it and show an alert.
    2. The widget should be able to detect a predefined system idle time (wherein the user is not interacting with the system as a whole - neither mouse nor keyboard inputs - for a predefined interval), and perform an action based on that.
    How shall it be possible to detect the above 2 scenarios in AIR?
    Any help in this regards, will be highly appreciated.
    Thanks in advance.
    Warm Regards,
    Parag

    Srini Chavali wrote:
    Pl check the ROW WHO information in FND_PROFILE_OPTIONS table for this profile - most likely this is a custom profile created at your site.
    http://etrm.oracle.com/pls/et1211d9/etrm_pnav.show_object?c_name=FND_PROFILE_OPTIONS&c_owner=APPLSYS&c_type=TABLE
    HTH
    SriniThis profile option exists in 11i and R12, it is a seeded one and not a custom one as you mentioned above.
    It is even mentioned in (R12.0.6+ : Oracle Application Object Library Profile Options Data Collection Test [ID 471675.1]).
    Thanks,
    Hussen

  • How to get calendar travel time (set up in Mavericks) to show on iOS 7 calendar?

    I was wondering how to get calendar travel time (set up in Mavericks) to show on iOS 7 calendar? If I change a location in mavericaks it is updated in my iOS 7 calendar, but if I add travel time to an appointment, that does not show up on my iphone. This seems like a big miss for apple if this is the case. I could maybe understand not adding the ability to add travel time in iOS 7, but not being able to see the travel times you set up seems very incomplete. Any ideas or insight?

    Hello Cheer,
    I don't believe the table changed when migrating from Access.  I had two tables before the migration, one was for the SwitchBoard Manager and the other table was for the database table.  I used the Switchboard to navigate to different menus, such
    as the Main Form, Power Form, Server Form, etc.  Let me know if I can provide any other information to help you narrow this down for me.   
    Thank you for your assistance. 
    Thai

  • How to get the end time of an Interface?

    How to get the end time of an Interface?

    Hi,
    As per your reuirement. I will suggest to use IKM SQL to SQL append. and Before Insert statement in IKM u need to add one more step i.e update. Your update should be like this
    command on sourse.
    <%for (int i=0; i < odiRef.getDataSetCount(); i++){%>
    <%=odiRef.getDataSet(i, "Operator")%>
    select      <%=odiRef.getPop("DISTINCT_ROWS")%>
         <%=odiRef.getColList(i,"", "[EXPRESSION]\t[ALIAS_SEP] [CX_COL_NAME]", ",\n\t", "", "((INS and !TRG) and REW)")%>
    from     <%=odiRef.getFrom(i)%>
    where     <% if (odiRef.getDataSet(i, "HAS_JRN").equals("1")) { %>
         JRN_FLAG <> 'D'
         <%} else {%>
         (1=1)     
         <% } %>
    <%=odiRef.getJoin(i)%>
    <%=odiRef.getFilter(i)%>
    <%=odiRef.getJrnFilter(i)%>
    <%=odiRef.getGrpBy(i)%>
    <%=odiRef.getHaving(i)%>
    <%}%>
    Command on target..
    UPDATE <%=odiRef.getTable("L", "TARG_NAME", "A")%> T
    set <%=odiRef.getColList("", "T.[COL_NAME]", ",\n\t", "", "(UD2)")%> ='N',
    <%=odiRef.getColList("", "T.[COL_NAME]", ",\n\t", "", "(UD1)")%> =SYSDATE
    where (<%=odiRef.getColList("","T.[COL_NAME]", ", ", "", "UK")%>)
    in(<%=snpRef.getColList("", ":[CX_COL_NAME]", ", ", "", "UK")%>) and <%=odiRef.getColList("", "T.[COL_NAME]", ",\n\t", "", "(UD2)")%> <> 'N'
    check UD1 and UD2 columns.
    Hope this will help you.
    Regards
    Saurabh

  • How to dispaly System date time on Jsff page ?

    Friends,
    It would be simple question for you , Any one has idea about
    How to dispaly System date time on Jsff page using any expression laungage ?
    Thanks in Advance

    Hi,
    I have a solution for you I hope that is helps.
    add this to the top of your page...
    <jsp:useBean id="now" class="java.util.Date" scope="request" />
    so, you want the current date?
    <af:outputText value="#{now}"/>
    you can use the format for date also.
    I hope it is what you want.

  • How to get the date time format in OCI

    How to get a date time format in OCI instead of only date

    You would have to use the OCIDateTime datatype for this. Refer to
    OCI documentation for more details.

  • How to get System status Check Boxes into Query selection screen

    Dear experts,
    Pleas help in knowing how to get System status Check Boxes into quick view query (SQVI), selectionscreen.
    Regards
    Jogeswara Rao
    Edited by: K Jogeswara Rao on Jul 6, 2010 7:26 PM

    Problem solved through other Forum
    (Checkboxes not possible, some alternative solution to my requirement found)

  • How to get system temp dir. path on the fly ,system may be XP or Linux ??

    How to get system temp dir. path on the fly ,system may be XP or Linux ??
    please suggest solution

    The default temporary-file directory can be retrieved
    using:
    System.getProperty("java.io.tmpdir")
    Thanks a lot for u r reply this one works !!!!

  • How to get system status and user status ?

    how to get system status and user status for the given production order?
    In which PP table we can
    find these?
    Thanks&Regards
    Satish

    Hi Ram,
    Use the FM "STATUS_READ" to read both the system and user statuses for an Order.
    Alternatively, the following tables store the user and system status info:
    JSTO- Status object information
    JEST- Individual Object Status
    Hope this helps.
    Let me know if u need further information.
    Regards,
    Sonal

  • How to get system Environment variable?

    How to get system Environment variable without using jni?
    just like "JAVA_HOME" or "PATH"...
    Any reply is help to me!! :-)

    Thx for your reply...
    I get it!!!
    Read environment variables from an application
    Start the JVM with the "-D" switch to pass properties to the application and read them with the System.getProperty() method. SET myvar=Hello world
    SET myothervar=nothing
    java -Dmyvar="%myvar%" -Dmyothervar="%myothervar%" myClass
    then in myClass String myvar = System.getProperty("myvar");
    String myothervar = System.getProperty("myothervar");
    This is useful when using a JAVA program as a CGI.
    (DOS bat file acting as a CGI) java -DREQUEST_METHOD="%REQUEST_METHOD%"
    -DQUERY_STRING="%QUERY_STRING%"
    javaCGI
    If you don't know in advance, the name of the variable to be passed to the JVM, then there is no 100% Java way to retrieve them.
    NOTE: JDK1.5 provides a way to achieve this, see this HowTo.
    One approach (not the easiest one), is to use a JNI call to fetch the variables, see this HowTo.
    A more low-tech way, is to launch the appropriate call to the operating system and capture the output. The following snippet puts all environment variables in a Properties class and display the value the TEMP variable. import java.io.*;
    import java.util.*;
    public class ReadEnv {
    public static Properties getEnvVars() throws Throwable {
    Process p = null;
    Properties envVars = new Properties();
    Runtime r = Runtime.getRuntime();
    String OS = System.getProperty("os.name").toLowerCase();
    // System.out.println(OS);
    if (OS.indexOf("windows 9") > -1) {
    p = r.exec( "command.com /c set" );
    else if ( (OS.indexOf("nt") > -1)
    || (OS.indexOf("windows 2000") > -1 )
    || (OS.indexOf("windows xp") > -1) ) {
    // thanks to JuanFran for the xp fix!
    p = r.exec( "cmd.exe /c set" );
    else {
    // our last hope, we assume Unix (thanks to H. Ware for the fix)
    p = r.exec( "env" );
    BufferedReader br = new BufferedReader
    ( new InputStreamReader( p.getInputStream() ) );
    String line;
    while( (line = br.readLine()) != null ) {
    int idx = line.indexOf( '=' );
    String key = line.substring( 0, idx );
    String value = line.substring( idx+1 );
    envVars.setProperty( key, value );
    // System.out.println( key + " = " + value );
    return envVars;
    public static void main(String args[]) {
    try {
    Properties p = ReadEnv.getEnvVars();
    System.out.println("the current value of TEMP is : " +
    p.getProperty("TEMP"));
    catch (Throwable e) {
    e.printStackTrace();
    Thanks to W.Rijnders for the W2K fix.
    An update from Van Ly :
    I found that, on Windows 2003 server, the property value for "os.name" is actually "windows 2003." So either that has to be added to the bunch of tests or just relax the comparison strings a bit: else if ( (OS.indexOf("nt") > -1)
    || (OS.indexOf("windows 2000") > -1 )
    || (OS.indexOf("windows 2003") > -1 ) // works but is quite specific to 2003
    || (OS.indexOf("windows xp") > -1) ) {
    else if ( (OS.indexOf("nt") > -1)
    || (OS.indexOf("windows 20") > -1 ) // probably is better since no other OS would return "windows" anyway
    || (OS.indexOf("windows xp") > -1) ) {
    I started with "windows 200" but thought "what the hell" and made it "windows 20" to lengthen its longivity. You could push it further and use "windows 2," I suppose. The only thing to watch out for is to not overlap with "windows 9."
    On Windows, pre-JDK 1.2 JVM has trouble reading the Output stream directly from the SET command, it never returns. Here 2 ways to bypass this behaviour.
    First, instead of calling directly the SET command, we use a BAT file, after the SET command we print a known string. Then, in Java, when we read this known string, we exit from loop. [env.bat]
    @set
    @echo **end
    [java]
    if (OS.indexOf("windows") > -1) {
    p = r.exec( "env.bat" );
    while( (line = br.readLine()) != null ) {
    if (line.indexOf("**end")>-1) break;
    int idx = line.indexOf( '=' );
    String key = line.substring( 0, idx );
    String value = line.substring( idx+1 );
    hash.put( key, value );
    System.out.println( key + " = " + value );
    The other solution is to send the result of the SET command to file and then read the file from Java. ...
    if (OS.indexOf("windows 9") > -1) {
    p = r.exec( "command.com /c set > envvar.txt" );
    else if ( (OS.indexOf("nt") > -1)
    || (OS.indexOf("windows 2000") > -1
    || (OS.indexOf("windows xp") > -1) ) {
    // thanks to JuanFran for the xp fix!
    p = r.exec( "cmd.exe /c set > envvar.txt" );
    // then read back the file
    Properties p = new Properties();
    p.load(new FileInputStream("envvar.txt"));
    Thanks to JP Daviau
    // UNIX
    public Properties getEnvironment() throws java.io.IOException {
    Properties env = new Properties();
    env.load(Runtime.getRuntime().exec("env").getInputStream());
    return env;
    Properties env = getEnvironment();
    String myEnvVar = env.get("MYENV_VAR");
    To read only one variable : // NT version , adaptation for other OS is left as an exercise...
    Process p = Runtime.getRuntime().exec("cmd.exe /c echo %MYVAR%");
    BufferedReader br = new BufferedReader
    ( new InputStreamReader( p.getInputStream() ) );
    String myvar = br.readLine();
    System.out.println(myvar);
    Java's System properties contains some useful informations about the environment, for example, the TEMP and PATH environment variables (on Windows). public class ShowSome {
    public static void main(String args[]){
    System.out.println("TEMP : " + System.getProperty("java.io.tmpdir"));
    System.out.println("PATH : " + System.getProperty("java.library.path"));
    System.out.println("CLASSPATH : " + System.getProperty("java.class.path"));
    System.out.println("SYSTEM DIR : " +
    System.getProperty("user.home")); // ex. c:\windows on Win9x system
    System.out.println("CURRENT DIR: " + System.getProperty("user.dir"));
    Here some tips from H. Ware about the PATH on different OS.
    PATH is not quite the same as library path. In unixes, they are completely different---the libraries typically have their own directories. System.out.println("the current value of PATH is: {" +
    p.getProperty("PATH")+"}");
    System.out.println("LIBPATH: {" +
    System.getProperty("java.library.path")+"}");
    gives the current value of PATH is:
    {/home/hware/bin:/usr/local/bin:/usr/xpg4/bin:/opt/SUNWspro/bin:/usr/ccs/bin:
    /usr/ucb:/bin:/usr/bin:/home/hware/linux-bin:/usr/openwin/bin/:/usr/games/:
    /usr/local/games:/usr/ccs/lib/:/usr/new:/usr/sbin/:/sbin/:/usr/hosts/:
    /usr/openwin/lib:/usr/X11/bin:/usr/bin/X11/:/usr/local/bin/X11:
    /usr/bin/pbmplus:/usr/etc/:/usr/dt/bin/:/usr/lib:/usr/lib/lp/postscript:
    /usr/lib/nis:/usr/share/bin:/usr/share/bin/X11:
    /home/hware/work/cdk/main/cdk/../bin:/home/hware/work/cdk/main/cdk/bin:.}
    LIBPATH:
    {/usr/lib/j2re1.3/lib/i386:/usr/lib/j2re1.3/lib/i386/native_threads:
    /usr/lib/j2re1.3/lib/i386/client:/usr/lib/j2sdk1.3/lib/i386:/usr/lib:/lib}
    on my linux workstation. (java added all those execpt /lib and /usr/lib). But these two lines aren't the same on window either:
    This system is windows nt the current value of PATH is:
    {d:\OrbixWeb3.2\bin;D:\jdk1.3\bin;c:\depot\cdk\main\cdk\bin;c:\depot\
    cdk\main\cdk\..\bin;d:\OrbixWeb3.2\bin;D:\Program
    Files\IBM\GSK\lib;H:\pvcs65\VM\win32\bin;c:\cygnus
    \cygwin-b20\H-i586-cygwin32\bin;d:\cfn\bin;D:\orant\bin;C:\WINNT\system32;C:\WINNT;
    C:\Program Files\Dell\OpenManage\Resolution Assistant\Common\bin;
    d:\Program Files\Symantec\pcAnywhere;
    C:\Program Files\Executive Software\DiskeeperServer\;C:\Program Files\Perforce}
    LIBPATH:
    {D:\jdk1.3\bin;.;C:\WINNT\System32;C:\WINNT;d:\OrbixWeb3.2\bin;D:\jdk1.3\bin;
    c:\depot\cdk\main\cdk\bin;c:\depot\cdk\main\cdk\..\bin;
    d:\OrbixWeb3.2\bin;D:\Program Files\IBM\GSK\lib;
    H:\pvcs65\VM\win32\bin;c:\cygnus\cygwin-b20\H-i586-cygwin32\bin;d:\cfn\bin;
    D:\orant\bin;C:\WINNT\system32;
    C:\WINNT;C:\Program Files\Dell\OpenManage\ResolutionAssistant\Common\bin;
    d:\Program Files\Symantec\pcAnywhere;
    C:\Program Files\Executive Software\DiskeeperServer\;C:\Program Files\Perforce}

  • How to get system date??

    hi,can anybody tell me how to get system date in essbase?? i want to use it in calc script..Ayan

    The other thing you could do would be to write a custom macro or function to pull in the date or pass members to to do the comparisonGlenn S.

Maybe you are looking for

  • How to validate material status in physical Inv Doc creation using MI01

    Hi Experts, I would like to know how to validate material status while creating physical inventory document using MI01 transaction. I tried to figure out a suitable BADI and customer exits ,but it didnt work out well. Kindly share your thoughts on ho

  • Creating graphics 720p60 - DVCPRO HD

    Hello everyone. I am new to these forums, and Final Cut Pro in general. I have someone who needs me to make some graphic slides for them using either Photoshop, Powerpoint or Illustrator (whatever you users think is best for this job)... When I creat

  • How to give dynamically email id  in smart form send mail

    Hii All. how to provide dynamic  reciepint email id.. suppose cutomer email id i get from smtp_addr dataelement. then how to give this in my program?

  • Connection problems with the Olite database

    Hi, I have a problem when I want to execute a BPEL Process from the process manager. I get a java.sql.SQLException with the following message "[POL-3207] a corrupted data page was detected". The fact is that another person (with his own account) inst

  • Delete Google Search ?

    How do you delete the search history in google? While in Safari, if I simply "clear history" then go to google to do a search all of my old searches are there. I wrote a huge research paper, and it's getting annoying everytime I go to google and my p