public static byte[] calendarToRawBytes(Calendar timestamp,boolean honorDeviceTimeOffset){
  if (honorDeviceTimeOffset) {
    int offsetInHours=MiBandCoordinator.getDeviceTimeOffsetHours();
    if (offsetInHours != 0) {
      timestamp.add(Calendar.HOUR_OF_DAY,offsetInHours);
    }
  }
  byte[] year=fromUint16(timestamp.get(Calendar.YEAR));
  return new byte[]{year[0],year[1],fromUint8(timestamp.get(Calendar.MONTH) + 1),fromUint8(timestamp.get(Calendar.DATE)),fromUint8(timestamp.get(Calendar.HOUR_OF_DAY)),fromUint8(timestamp.get(Calendar.MINUTE)),fromUint8(timestamp.get(Calendar.SECOND)),dayOfWeekToRawBytes(timestamp),0};
}

public static byte [ ] calendarToRawBytes ( Calendar timestamp , boolean honorDeviceTimeOffset ) { if ( honorDeviceTimeOffset ) { int offsetInHours = MiBandCoordinator . getDeviceTimeOffsetHours ( ) ; if ( offsetInHours != 0 ) { timestamp . add ( Calendar . HOUR_OF_DAY , offsetInHours ) ; } } byte [ ] year = fromUint16 ( timestamp . get ( Calendar . YEAR ) ) ; return new byte [ ] { year [ 0 ] , year [ 1 ] , fromUint8 ( timestamp . get ( Calendar . MONTH ) + 1 ) , fromUint8 ( timestamp . get ( Calendar . DATE ) ) , fromUint8 ( timestamp . get ( Calendar . HOUR_OF_DAY ) ) , fromUint8 ( timestamp . get ( Calendar . MINUTE ) ) , fromUint8 ( timestamp . get ( Calendar . SECOND ) ) , dayOfWeekToRawBytes ( timestamp ) , 0 } ; }
converts a timestamp to the byte sequence to be sent to the current time characteristic
