1078-设置圆形区域...
This commit is contained in:
@@ -1,5 +1,12 @@
|
||||
package com.genersoft.iot.vmp.jt1078.util;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* BCD码转换
|
||||
*/
|
||||
@@ -19,4 +26,26 @@ public class BCDUtil {
|
||||
}
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 时间使用按照YY-MM-DD-hh-mm-ss,转换为byte数据
|
||||
*/
|
||||
public static ByteBuf transform(long time) {
|
||||
ByteBuf byteBuf = Unpooled.buffer();
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(time);
|
||||
int year = calendar.get(Calendar.YEAR);
|
||||
int month = calendar.get(Calendar.MONTH) + 1 ;
|
||||
int day = calendar.get(Calendar.DAY_OF_MONTH);
|
||||
int hour = calendar.get(Calendar.HOUR_OF_DAY);
|
||||
int minute = calendar.get(Calendar.MINUTE);
|
||||
int second = calendar.get(Calendar.SECOND);
|
||||
byteBuf.writeByte(year);
|
||||
byteBuf.writeByte(month);
|
||||
byteBuf.writeByte(day);
|
||||
byteBuf.writeByte(hour);
|
||||
byteBuf.writeByte(minute);
|
||||
byteBuf.writeByte(second);
|
||||
return byteBuf;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user