Esempio n. 1
0
 /**
  * Adds the time to the specified token builder.
  *
  * @param tb token builder
  */
 final void time(final TokenBuilder tb) {
   if (sec.remainder(DAYSECONDS).signum() == 0) return;
   tb.add('T');
   final long h = hou();
   if (h != 0) {
     tb.addLong(Math.abs(h));
     tb.add('H');
   }
   final long m = min();
   if (m != 0) {
     tb.addLong(Math.abs(m));
     tb.add('M');
   }
   final BigDecimal sc = sec();
   if (sc.signum() == 0) return;
   tb.add(Token.chopNumber(Token.token(sc.abs().toPlainString()))).add('S');
 }
Esempio n. 2
0
 @Override
 public byte[] string(final InputInfo ii) {
   final TokenBuilder tb = new TokenBuilder();
   final boolean ymd = yea != Long.MAX_VALUE;
   if (ymd) {
     if (yea <= 0) tb.add('-');
     prefix(tb, Math.abs(yea()), 4);
     tb.add('-');
     prefix(tb, mon(), 2);
     tb.add('-');
     prefix(tb, day(), 2);
   }
   if (hou >= 0) {
     if (ymd) tb.add('T');
     prefix(tb, hou(), 2);
     tb.add(':');
     prefix(tb, min(), 2);
     tb.add(':');
     if (sec.intValue() < 10) tb.add('0');
     tb.addExt(Token.chopNumber(Token.token(sec().abs().toPlainString())));
   }
   zone(tb);
   return tb.finish();
 }