/* start_time (current time) delta1 = E (encoded submission time) delta2 = C (encoded current time) 0x01C2 = Pn + 15min (maximum point for S1) 0x7E38 = Pn+1 - 15min (minimum point for S3) 0x7FF8 = Pn+1 (length of P (period))  */
static gint32 dmp_dec_subm_time(guint16 delta1, gint32 start_time)
/* start_time (current time) delta1 = E (encoded submission time) delta2 = C (encoded current time) 0x01C2 = Pn + 15min (maximum point for S1) 0x7E38 = Pn+1 - 15min (minimum point for S3) 0x7FF8 = Pn+1 (length of P (period))  */
static gint32 dmp_dec_subm_time(guint16 delta1, gint32 start_time)
{
  gint32  subm_time = start_time;
  guint16 delta2;
  delta2 = (guint16) ((subm_time / 2) % 0x7FF8);
  if ((delta1 < 0x01C2) && (delta2 >= delta1 + 0x7E38)) {
    subm_time += 2 * (0x7FF8 - delta2 + delta1);
  } else if ((delta1 >= 0x01C2) && (delta2 < delta1 - 0x01C2)) {
    subm_time -= 2 * (0x7FF8 - delta1 + delta2);
  } else {
    subm_time -= 2 * (delta2 - delta1);
  }
  return subm_time;
}