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

Method toDelay

basex-core/src/main/java/org/basex/core/jobs/QueryJob.java:150–172  ·  view source on GitHub ↗

Returns a delay. @param start start (integer, dayTimeDuration, dateTime, time) @param min minimum time @param info input info (can be null) @return milliseconds to wait @throws QueryException query exception

(final Item start, final long min, final InputInfo info)

Source from the content-addressed store, hash-verified

148 * @throws QueryException query exception
149 */
150 public static long toDelay(final Item start, final long min, final InputInfo info)
151 throws QueryException {
152
153 final QueryDateTime qdt = new QueryDateTime();
154 long ms;
155 if(start instanceof final Itr itr) {
156 // time
157 ms = itr.itr() * 60000;
158 ms -= qdt.time.daySeconds().multiply(Dec.BD_1000).longValue();
159 while(ms <= min) ms += 3600000;
160 } else if(start instanceof final DTDur dur) {
161 // dayTimeDuration
162 ms = dur.ms(info);
163 } else if(start instanceof final Dtm dtm) {
164 // dateTime
165 ms = new DTDur(dtm, qdt.datm, info).ms(info);
166 } else {
167 // time
168 ms = new DTDur((Tim) start, qdt.time, info).ms(info);
169 while(ms <= min) ms += 86400000;
170 }
171 return ms;
172 }
173
174 /**
175 * Removes the job from the task list as soon as it has been activated.

Callers 1

QueryJobMethod · 0.95

Calls 4

multiplyMethod · 0.80
daySecondsMethod · 0.80
msMethod · 0.80
itrMethod · 0.45

Tested by

no test coverage detected