(
Timezone tz,
StartOfDay startOfDay
)
| 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) { |
nothing calls this directly
no test coverage detected