package com.dev.fbs9100;
|
|
import java.nio.ByteBuffer;
|
import java.nio.ByteOrder;
|
|
public class FBS9100_TestTime
|
{
|
public int hour = 0;
|
public int minute = 0;
|
public int second = 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 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()
|
{
|
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) ******************************
|
***************************************************************************************/
|