亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? clock.java

?? java包
?? JAVA
字號:
package javabook;

import java.util.*;

/**
 * This class supports some basic clock functions such as reading the current time,
 * getting today's date, and stop watch function. This class also supports a convenient
 * function to pause the program execution. 
 * <p>
 * This class is provided as freeware. You are free to use as provided or modify to
 * your heart's content. But you use it at your own risk. No implied or explicit 
 * warranty is given.
 * <p>
 * @author C. Thomas Wu a.k.a Dr. Caffeine
 */
public class Clock
{

//----------------------------------
//    Data Members:
//----------------------------------

    /**
     * Designates the long format for date
     */
    public static final  int     LONG_FORMAT  = 0;
    
    /**
     * Designates the short format for date
     */
    public static final  int     SHORT_FORMAT = 1;

    /**
     * Designates the 12-hr format for time
     */
    public static final  int     TIME_12HR_FORMAT  = 0;
    
    /**
     * Designates the 24-hr format for time
     */
    public static final  int     TIME_24HR_FORMAT = 1;
    
    /**
     * Month names for long format display
     */
    private static final String[] MONTH_NAME =
       { "January", "February", "March", "April", "May", "June",
         "July", "August", "September","October", "November", "December"};

    /**
     * True when the stop watch is running
     */
    private boolean clockRunning;
    
    /**
     * Elapsed time from the first start to the last stop or current time
     */
    private long    totalElapsedTime;
    
    /**
     * Elapsed time from the most recent start to the last stop
     */
    private long    elapsedTime;
    
    /**
     * The most recent start time of the stop watch function
     */    
    private long    startTime;
    
    /**
     * The most recent stop time (i.e., the last) of the stop watch function
     */
    private long    stopTime;


//-----------------------------------
//    Constructors
//-----------------------------------
    
    /**
     * Default constructor.
     */
    public Clock( )
    {
        reset( ); 
    }
    

//-----------------------------------------------
//    Public Methods:
//
//        String    getCurrentDate      (           )
//        String    getCurrentDate      ( int       )
//        
//        String    getCurrentTime      (           )
//        String    getCurrentTime      ( int       )
//
//        double    getElapsedTime      (           )
//        double    getTotalElapsedTime (           )
//
//        void      pause               ( double    )
//        void      start               (           )
//        void      stop                (           )
//
//-------------------------------------------------
 
    /**
     * Returns the current (today's) date in the mm/dd/yyyy
     * format. 
     *
     * @return today's date in either the mm/dd/yyyy format
     */
    public String getCurrentDate( )
    {
        return this.getCurrentDate( SHORT_FORMAT );
    }
   
    /**
     * Returns the current (today's) date in short or long format.
     * The short format has the standard mm/dd/yyyy. The long format
     * spells out the month name.
     *
     * @param format specify LONG_FORMAT or SHORT_FORMAT 
     *
     * @return today's date in either short or long format
     */
    public String getCurrentDate(int format)
    {
        String dateString = "";
        int month, day, year;
        
        GregorianCalendar   date   = new GregorianCalendar( );
        
        month = date.get(Calendar.MONTH);
        day   = date.get(Calendar.DAY_OF_MONTH);
        year  = date.get(Calendar.YEAR);     
                   
        switch (format) {
            
            case LONG_FORMAT:
                
                dateString = MONTH_NAME[month] + " " + day + ", " + year;
                
                break;
                
            case SHORT_FORMAT:
            default:
 
                dateString = Format.rightAlign(2, month+1) + "/" +
                             Format.rightAlign(2, day)     + "/" +
                                                  year;  
                break;
        }
        
        return dateString;
    }
    
    /**
     * Returns the current time in the 12-hr format.
     *
     * @return current time in the 12-hr format
     */
    public String getCurrentTime( )
    {
        return this.getCurrentTime( TIME_12HR_FORMAT );
    }
    
    /**
     * Returns the current time in 24-hr or 12-hr format.
     * The 12-hr format will include the AM/PM designation.
     *
     * @param format specify TIME_12HR_FORMAT or TIME_24HR_FORMAT 
     *
     * @return current time in either 12-hr or 24-hr format
     */
    public String getCurrentTime(int format)
    {
        String timeString, hourStr, minuteStr, secondStr, am_pm_Str;
        
        int    hour, minute, second, hourOfDay;
        
        GregorianCalendar   date  = new GregorianCalendar( );
        
        minute = date.get(Calendar.MINUTE);
        second = date.get(Calendar.SECOND); 
        
        if (format == TIME_12HR_FORMAT) {
                
            hour   = date.get(Calendar.HOUR);
                
            if (date.get(Calendar.AM_PM) == Calendar.AM) {
                 am_pm_Str = " AM";
            }
            else {
                 am_pm_Str = " PM";
            }                
        }
        else {              
            hour   = date.get(Calendar.HOUR_OF_DAY); 
                
            am_pm_Str = "";              
        }

        //prepend "0" for the value < 10 so we will have 08:05:10
        //instead of 8:5:10
        if (hour < 10 ) {
            hourStr = "0" + hour;
        }
        else {
            hourStr = "" + hour;
        }
        
        if (minute < 10) {
            minuteStr = "0" + minute;
        }
        else {
            minuteStr = "" + minute;
        }
        
        if (second < 10) {
            secondStr = "0" + second;
        }
        else {
            secondStr = "" + second;
        }
               
        timeString = hourStr + ":" + minuteStr + ":" + secondStr + " " + am_pm_Str;
                                        
        return timeString;
    }
    
    /**
     * Returns the elapsed time of the stop watch function.
     * The elapsed time is the time interval between the most recent start and stop. 
     * If the stop watch is still running, then this method returns the elapsed time from
     * the most recent call to the start method until this method is called. 
     * The stop watch will keep on running. 
     *
     * @return elapsed time (unit is seconds)
     */
    public double getElapsedTime( )
    {
        double timeInterval;
        
        if (clockRunning) {
            //get the current time and compute the elapsed time
            //and keep the clock running
            
            timeInterval = (System.currentTimeMillis( ) - startTime)  / 1000.0;                      
        }
        else {
            timeInterval = elapsedTime / 1000.0;
        }
        
        return timeInterval; //the unit is in seconds
    }

     
    /**
     * Returns the total elapsed time of the stop watch function.
     * The total elapsed time is the time interval between the first start and the last stop. 
     * If the stop watch is still running, then this method returns the elapsed time
     * from the first time the stop watch is started till the time this method is called. 
     * The stop watch will keep on running. 
     *
     * @return elapsed time (unit is seconds)
     */ 
    public double getTotalElapsedTime( )
    {
        double timeInterval;
        
        if (clockRunning) {
            //get the current time and compute the totalElapsedTime
            //and keep the clock running
            long currentTime = System.currentTimeMillis( );
            long currentElapsedTime = totalElapsedTime + (currentTime - startTime);
            
            timeInterval = currentElapsedTime / 1000.0;            
            
        }
        else {
            timeInterval = totalElapsedTime  / 1000.0;
        }
                
        return timeInterval; //the unit is in seconds
    }
            
    /**
      * Pauses the program execution.
      * If the clock is running, then the timer keeps on
      * counting while the program execution is paused.
      * If the clock is not running, then this method simply pauses the
      * program execution.
      *
      * @param duration the amount to time (in seconds) to pause the program execution
      */
    public void pause( double duration )
    {      
        long pauseTime;
        
        pauseTime = (long) (duration * 1000);
              
        try {
            Thread.sleep( pauseTime );
        }
        catch (Exception e) { }
    }
    
    /**
     * Resets the stop watch to its initial state.
     */
    public void reset( )
    {
        clockRunning = false;
        
        totalElapsedTime  = 0;       
    }
    
    /**
     * Starts the clock's stop watch.
     * If the stop watch is already running, then this method is imply ignored.
     */
    public void start( )
    {
        if (!clockRunning) { //ignore if the clock is already running
                             
            clockRunning = true;
            
            startTime = System.currentTimeMillis();
        }
    }
    
    /** 
     * Stops the clock's stop watch.
     * If the stop watch is not running, then this method is simply ignored.
     */
    public void stop( )
    {
        if (clockRunning) { //ignore if not running
        
            clockRunning = false;
            
            stopTime = System.currentTimeMillis( );
            
            elapsedTime = (stopTime - startTime);

            totalElapsedTime += elapsedTime; 
        }
    }
    
    
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲一区二区三区不卡国产欧美| 日韩精品一级二级| 欧美亚洲日本国产| 91久久精品一区二区三| 91啪亚洲精品| 欧美亚洲一区二区三区四区| 久久精品人人做人人爽97| 国产日韩av一区| 亚洲欧洲精品一区二区三区 | 豆国产96在线|亚洲| 国产激情91久久精品导航| 国产成人激情av| 日韩欧美高清在线| 久久久天堂av| 亚洲男女毛片无遮挡| 亚洲成av人片在线观看无码| 日本不卡一区二区三区高清视频| 蜜桃久久久久久久| 高清久久久久久| 久久影音资源网| 亚洲欧美日韩小说| 成人av手机在线观看| 欧美美女黄视频| 欧美激情一区三区| 日产国产欧美视频一区精品| 欧美色图片你懂的| 欧美片网站yy| 久久精品视频一区| 国产精品一品视频| 欧美二区乱c少妇| 婷婷夜色潮精品综合在线| 国产成人亚洲综合色影视| 久久美女艺术照精彩视频福利播放 | 亚洲一区日韩精品中文字幕| 91免费国产在线观看| 中文字幕日本不卡| 色又黄又爽网站www久久| 日韩情涩欧美日韩视频| 国产精品国产a| 免费观看在线色综合| av在线播放成人| 欧美精品一区二区三区视频| 亚洲一区二区欧美日韩| 欧美少妇性性性| 免费观看在线色综合| 精品国产伦一区二区三区免费| 激情五月婷婷综合| 日韩一级二级三级精品视频| 美女性感视频久久| 国产区在线观看成人精品| 99麻豆久久久国产精品免费| 亚洲乱码日产精品bd| 国产成人免费高清| 综合久久久久久久| 国产成人综合亚洲网站| 国产精品久久久久7777按摩| 色欧美乱欧美15图片| 青青草伊人久久| 久久―日本道色综合久久| 成人美女在线视频| 中国色在线观看另类| 国产一区二区不卡在线| 日韩一区二区三区四区五区六区| 国内精品伊人久久久久av一坑| 欧美国产综合一区二区| 91国模大尺度私拍在线视频| 久久er99精品| 精品久久久久久亚洲综合网| 男人的天堂亚洲一区| 国产精品国产精品国产专区不蜜 | 亚洲国产成人tv| 色哟哟国产精品免费观看| 美日韩一区二区| 亚洲人成在线观看一区二区| 日韩欧美一级片| 在线一区二区观看| 国产一区二区三区久久久| 一区二区三区免费观看| 欧美性猛片aaaaaaa做受| 久久99精品久久久久| 久久综合色综合88| 欧美专区日韩专区| 日韩av中文在线观看| 自拍av一区二区三区| 精品国产乱码久久久久久夜甘婷婷| 色综合久久天天综合网| 国产露脸91国语对白| 日本不卡在线视频| 亚洲高清不卡在线观看| 国产精品色在线| 久久久久亚洲综合| 日韩一级黄色大片| 欧美日韩国产小视频在线观看| 成人97人人超碰人人99| 国产精品一品二品| 美女视频网站黄色亚洲| 五月天亚洲精品| 亚洲一区电影777| 亚洲男人天堂av| 亚洲欧美日韩成人高清在线一区| 国产亚洲污的网站| 久久久国产精品麻豆| 精品福利av导航| 日韩视频在线永久播放| 欧美电影在哪看比较好| 欧美日韩国产精品成人| 欧美日韩激情在线| 欧美精品vⅰdeose4hd| 欧美影视一区二区三区| 欧美在线免费播放| 在线免费观看一区| 欧美图片一区二区三区| 欧美日本精品一区二区三区| 欧美探花视频资源| 8x福利精品第一导航| 成人黄色在线看| 99久久亚洲一区二区三区青草| 免费久久精品视频| 精品一区二区在线观看| 国产毛片精品视频| 国产91丝袜在线播放0| 成人一道本在线| 99国产精品国产精品毛片| 色婷婷精品久久二区二区蜜臀av | 亚洲成人精品一区二区| 五月激情综合网| 九九国产精品视频| 国产剧情一区二区| 福利一区二区在线观看| 成人av手机在线观看| 一本色道久久综合精品竹菊| 欧美午夜精品理论片a级按摩| 69精品人人人人| 久久亚洲精精品中文字幕早川悠里| 中文字幕av在线一区二区三区| 亚洲三级在线播放| 五月婷婷久久丁香| 国产丶欧美丶日本不卡视频| 91在线看国产| 欧美一区二区在线不卡| 欧美亚洲国产一区二区三区va| 337p亚洲精品色噜噜噜| 欧美成人精品3d动漫h| 亚洲欧洲精品一区二区精品久久久 | 国产伦精品一区二区三区视频青涩| 国产一区日韩二区欧美三区| 成人激情文学综合网| 欧美日韩综合在线免费观看| 91精品国产综合久久久蜜臀粉嫩| 日韩免费电影网站| 亚洲国产精品高清| 男人的天堂久久精品| 成人av免费网站| 欧美一二三区精品| 亚洲天堂成人在线观看| 美女一区二区三区| 一本到三区不卡视频| 久久一区二区三区四区| 亚洲美女免费视频| 国产一区 二区 三区一级| 色综合天天综合网天天狠天天| 波多野结衣一区二区三区| 欧美精品视频www在线观看| 国产日韩欧美a| 日韩av一级片| 成人动漫av在线| 日韩丝袜美女视频| 亚洲国产精品久久久久秋霞影院| 国内精品自线一区二区三区视频| 日本福利一区二区| 国产视频一区在线观看| 免费成人av在线播放| 97久久精品人人爽人人爽蜜臀| 欧美一区二区视频在线观看 | 久久久久久久久99精品| 五月天一区二区| 欧美性大战久久| 日韩一区欧美小说| 国产精品一区一区| 日韩视频中午一区| 樱桃国产成人精品视频| 成人网页在线观看| 久久综合一区二区| 精品一区二区三区的国产在线播放| 欧洲色大大久久| 亚洲美腿欧美偷拍| 91欧美一区二区| 国产精品久久久久影院| 国产91精品一区二区麻豆亚洲| 日韩欧美三级在线| 秋霞影院一区二区| 欧美日产在线观看| 日韩精品高清不卡| 欧美精品久久99久久在免费线| 一区二区三区日韩精品| 色一情一乱一乱一91av| 国产精品久久久久久久久免费丝袜| 国产馆精品极品| 国产欧美在线观看一区| av亚洲精华国产精华精|