MCPcopy Create free account
hub / github.com/BaseXdb/basex / time

Method time

basex-core/src/main/java/org/basex/query/value/item/Dur.java:223–233  ·  view source on GitHub ↗

Adds the time to the specified token builder. @param tb token builder

(final TokenBuilder tb)

Source from the content-addressed store, hash-verified

221 * @param tb token builder
222 */
223 final void time(final TokenBuilder tb) {
224 if(seconds.remainder(BD_864000).signum() == 0) return;
225 tb.add('T');
226 final long h = hour();
227 if(h != 0) { tb.addLong(Math.abs(h)); tb.add('H'); }
228 final long m = minute();
229 if(m != 0) { tb.addLong(Math.abs(m)); tb.add('M'); }
230 final BigDecimal sc = seconds();
231 if(sc.signum() == 0) return;
232 tb.add(Token.chopNumber(Token.token(sc.abs().toPlainString()))).add('S');
233 }
234
235 @Override
236 public int compare(final Item item, final Collation coll, final boolean transitive,

Callers 4

stringMethod · 0.95
DtmMethod · 0.45
stringMethod · 0.45
TimMethod · 0.45

Calls 8

hourMethod · 0.95
minuteMethod · 0.95
secondsMethod · 0.95
chopNumberMethod · 0.95
tokenMethod · 0.95
addLongMethod · 0.80
addMethod · 0.65
absMethod · 0.45

Tested by

no test coverage detected