⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 uptime.java

📁 multiplataform real time Linux monitor
💻 JAVA
字号:
/** LiMon-JClient *  Copyright (C) 2006 Marcelo Busico * *  Author:  Marcelo Busico    marcelobusico@gmail.com * *  This program is free software which I release under the GNU General Public *  License. You may redistribute and/or modify this program under the terms *  of that license as published by the Free Software Foundation; either *  version 2 of the License, or (at your option) any later version. * *  This program is distributed in the hope that it will be useful, *  but WITHOUT ANY WARRANTY; without even the implied warranty of *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the *  GNU General Public License for more details.  Version 2 is in the *  LICENSE.txt file in the top level directory of this distribution. *  *  To get a copy of the GNU General Puplic License, write to the Free Software *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */package limonclient;import java.io.*;public class UpTime {    //Es de tipo int que en java es de 4 bytes equivalente a Long en C++    private int tiempo;        /** Crea una nueva instancia de UpTime */    public UpTime() {    }    /** Devuelve el tiempo en segundos desde que se encendio el servidor */    public int getTiempo()    {        return tiempo;    }        /** Devuelve los dias transcurridos desde que se encendio el servidor */    public int getDias()    {        return (int)(tiempo/86400);    }    /** Devuelve las horas transcurridas en el dia desde que se encendio el servidor */    public int getHoras()    {        return (int) ((tiempo-(getDias()*86400))/3600);    }    /** Devuelve los minutos transcurridos en la hora en el dia desde que se encendio el servidor */    public int getMinutos()    {        return (int) ((tiempo-(getDias()*86400)-(getHoras()*3600))/60);    }                /** Devuelve toda la informacion del objeto en una cadena */    public String toString()    {        //return ("Tiempo en servicio: " + tiempo + " segundos");        return (getDias() + " Días, " + getHoras() + " Horas, " + getMinutos() + " Minutos");    }    /** Recibe los atributos del objeto desde la conexion      * Demora: 50 lecturas en 5 segundos     */    public void recibirObjeto(Conexion con) throws IOException    {        //Envia peticion        Cabecera envCab=new Cabecera(Cabecera.IdPedirUpTime,con.getPassword());        envCab.enviarCabecera(con.getSalida());        //Recibe cabecera del servidor        Cabecera recCab=new Cabecera();        recCab.recibirCabecera(con.getEntrada());        //Verifica que la cabecera sea la solicitada        if(recCab.getIdentificador()==Cabecera.IdDevolverUpTime)        {            tiempo=con.getEntrada().readInt();        }    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -