(
ZonalOffset offset,
StartOfDay startOfDay
)
| 382 | * @since 3.8/4.5 |
| 383 | */ |
| 384 | public Moment at( |
| 385 | ZonalOffset offset, |
| 386 | StartOfDay startOfDay |
| 387 | ) { |
| 388 | |
| 389 | PlainTimestamp tsp = ( |
| 390 | (this.cv == null) |
| 391 | ? this.ca.transform(PlainDate.class).at(this.time) |
| 392 | : this.cv.transform(PlainDate.class).at(this.time)); |
| 393 | |
| 394 | // assuming that deviation will not change much by one day difference (approximation) |
| 395 | int deviation = startOfDay.getDeviation(tsp.getCalendarDate(), offset); |
| 396 | int comp = this.time.get(PlainTime.SECOND_OF_DAY).intValue() - deviation; |
| 397 | |
| 398 | if (comp >= 86400) { // happens if sunset is the start of day |
| 399 | tsp = tsp.minus(1, CalendarUnit.DAYS); |
| 400 | } else if (comp < 0) { // happens if sunrise is the start of day |
| 401 | tsp = tsp.plus(1, CalendarUnit.DAYS); |
| 402 | } |
| 403 | |
| 404 | return tsp.at(offset); |
| 405 | |
| 406 | } |
| 407 | |
| 408 | /** |
| 409 | * <p>Combines this general timestamp with given timezone to a global UTC-moment. </p> |
nothing calls this directly
no test coverage detected