MCPcopy Create free account
hub / github.com/MenoData/Time4J / in

Method in

base/src/main/java/net/time4j/GeneralTimestamp.java:424–446  ·  view source on GitHub ↗
(
        Timezone tz,
        StartOfDay startOfDay
    )

Source from the content-addressed store, hash-verified

422 * @since 3.8/4.5
423 */
424 public Moment in(
425 Timezone tz,
426 StartOfDay startOfDay
427 ) {
428
429 PlainTimestamp tsp = (
430 (this.cv == null)
431 ? this.ca.transform(PlainDate.class).at(this.time)
432 : this.cv.transform(PlainDate.class).at(this.time));
433
434 // assuming that deviation will not change much by one day difference (approximation)
435 int deviation = startOfDay.getDeviation(tsp.getCalendarDate(), tz.getID());
436 int comp = this.time.get(PlainTime.SECOND_OF_DAY).intValue() - deviation;
437
438 if (comp >= 86400) { // happens if sunset is the start of day
439 tsp = tsp.minus(1, CalendarUnit.DAYS);
440 } else if (comp < 0) { // happens if sunrise is the start of day
441 tsp = tsp.plus(1, CalendarUnit.DAYS);
442 }
443
444 return tsp.in(tz);
445
446 }
447
448 @Override
449 public boolean contains(ChronoElement<?> element) {

Callers

nothing calls this directly

Calls 9

getCalendarDateMethod · 0.95
minusMethod · 0.95
plusMethod · 0.95
inMethod · 0.95
atMethod · 0.65
transformMethod · 0.65
getMethod · 0.65
getDeviationMethod · 0.45
getIDMethod · 0.45

Tested by

no test coverage detected