package com.dec.fbs9100;
|
|
import java.nio.ByteBuffer;
|
import java.nio.ByteOrder;
|
|
public class FBS9100_DateTime
|
{
|
public int year = 0;
|
public int month = 1;
|
public int day = 1;
|
public int hour = 0;
|
public int minute = 0;
|
public int second = 0;
|
|
public FBS9100_DateTime clone()
|
{
|
FBS9100_DateTime obj = new FBS9100_DateTime();
|
|
obj.year = year;
|
obj.month = month;
|
obj.day = day;
|
obj.hour = hour;
|
obj.minute = minute;
|
obj.second = second;
|
|
return obj;
|
}
|
|
public void putByteBuffer(final ByteBuffer bf)
|
{
|
year = FBS9100_ComBase.changeByteToInt(bf.get());
|
month = FBS9100_ComBase.changeByteToInt(bf.get());
|
day = FBS9100_ComBase.changeByteToInt(bf.get());
|
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(12);
|
bytebuffer.order(ByteOrder.LITTLE_ENDIAN);
|
bytebuffer.put(FBS9100_ComBase.changeIntToByte(year));
|
bytebuffer.put(FBS9100_ComBase.changeIntToByte(month));
|
bytebuffer.put(FBS9100_ComBase.changeIntToByte(day));
|
bytebuffer.put(FBS9100_ComBase.changeIntToByte(hour));
|
bytebuffer.put(FBS9100_ComBase.changeIntToByte(minute));
|
bytebuffer.put(FBS9100_ComBase.changeIntToByte(second));
|
bytebuffer.flip();
|
System.out.println("date limit:"+bytebuffer.limit());
|
return bytebuffer;
|
}
|
|
|
|
|
// public static void main(String[] args) {
|
// FBS9100_DateTime time = new FBS9100_DateTime();
|
// Calendar now = Calendar.getInstance();
|
//
|
// time.year = now.get(Calendar.YEAR);
|
// time.month = (now.get(Calendar.MONTH) + 1);
|
// time.day = now.get(Calendar.DAY_OF_MONTH);
|
// time.hour = now.get(Calendar.HOUR_OF_DAY);
|
// time.minute = now.get(Calendar.MINUTE);
|
// time.second = now.get(Calendar.SECOND);
|
//
|
// ByteBuffer bf = time.getBytes();
|
// time.putByteBuffer(bf);
|
// System.out.println(time);
|
// }
|
|
@Override
|
public String toString() {
|
return "FBS9100_DateTime [year=" + year + ", month=" + month + ", day=" + day + ", hour=" + hour + ", minute="
|
+ minute + ", second=" + second + "]";
|
}
|
}
|
/***************************************************************************************
|
*************************** end of file (FBS_DateTime) *********************************
|
***************************************************************************************/
|