1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
package com.dec.fbs9100;
 
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.Date;
 
public class FBS9100_TestTime 
{
    public static Date startime ;
    public int startimeint = 0;
    public int hour = 0;
    public int minute = 0;
    public int second = 0;
    public int timelonog = 0;
    public void putByteBuffer(final ByteBuffer bf)
    {
        hour = FBS9100_ComBase.changeByteToInt(bf.get());
        minute = FBS9100_ComBase.changeByteToInt(bf.get());
        second = FBS9100_ComBase.changeByteToInt(bf.get());
    }
    public static void starttime()
    {
        startime = new Date();
    }
    public static void restarttime() {
        startime = null;
    }
    public ByteBuffer getBytes()
    {
        ByteBuffer bytebuffer = ByteBuffer.allocate(6);
        bytebuffer.order(ByteOrder.LITTLE_ENDIAN);
        bytebuffer.put(FBS9100_ComBase.changeIntToByte(hour));
        bytebuffer.put(FBS9100_ComBase.changeIntToByte(minute));
        bytebuffer.put(FBS9100_ComBase.changeIntToByte(second));
        bytebuffer.flip();
        
        return bytebuffer;
    }
    
    public int getSecondCount()
    {
        Date nowTime = new Date();
        int Timelong;
        //return (hour*3600 + minute*60 + second);
        //int Timelong = (int) ((nowTime.getTime() - startime.getTime())/1000);
        //System.out.println("startime:"+startime);
        if(startime !=null) {
            
            Timelong = (int) ((nowTime.getTime() - startime.getTime())/1000);
            //System.out.println("Timelong:"+Timelong);
        }else {
            return (hour*3600 + minute*60 + second);
        }
        //System.out.println(startime);
        //System.out.println(Timelong);
        return Timelong;
    }
    
//    public int getSecondCount()
//    {
//        return (hour*3600 + minute*60 + second);
//    }
    public static int getMinutesCount(String str)
    {
        int mcount = 0;
        try
        {
            // ����������������������������������:��������������
            int position = str.indexOf(":");
            // ��������������:���������������������������������������������������
            mcount = Integer.parseInt(str.substring(0, position))*60;
            mcount += Integer.parseInt(str.substring(position + 1));
        }
        catch(Exception e)
        {
            mcount = 0;
        }
        
        return mcount;
    }
 
    @Override
    public String toString() {
        return "FBS9100_TestTime [hour=" + hour + ", minute=" + minute + ", second=" + second + "]";
    }
 
}
/***************************************************************************************
****************************** end of file (FBS_TestTime) ******************************
***************************************************************************************/