(
ChronoDisplay tsp,
int tz
)
| 270 | } |
| 271 | |
| 272 | private static XMLGregorianCalendar toXML( |
| 273 | ChronoDisplay tsp, |
| 274 | int tz |
| 275 | ) { |
| 276 | |
| 277 | PlainDate date = tsp.get(PlainDate.COMPONENT); |
| 278 | int year = date.getYear(); |
| 279 | int month = date.getMonth(); |
| 280 | int dom = date.getDayOfMonth(); |
| 281 | |
| 282 | PlainTime time = tsp.get(PlainTime.COMPONENT); |
| 283 | int hour = time.getHour(); |
| 284 | int minute = time.getMinute(); |
| 285 | int second = tsp.get(PlainTime.SECOND_OF_MINUTE); // LS |
| 286 | int nano = time.getNanosecond(); |
| 287 | |
| 288 | DatatypeFactory factory = getXMLFactory(); |
| 289 | |
| 290 | if ((nano % MIO) == 0) { |
| 291 | int millis = nano / MIO; |
| 292 | return factory.newXMLGregorianCalendar( |
| 293 | year, month, dom, hour, minute, second, millis, tz); |
| 294 | } else { |
| 295 | BigInteger y = BigInteger.valueOf(year); |
| 296 | BigDecimal f = |
| 297 | BigDecimal.valueOf(nano).setScale(9, UNNECESSARY).divide(MRD_D, UNNECESSARY); |
| 298 | return factory.newXMLGregorianCalendar( |
| 299 | y, month, dom, hour, minute, second, f, tz); |
| 300 | } |
| 301 | |
| 302 | } |
| 303 | |
| 304 | //~ Innere Klassen ---------------------------------------------------- |
| 305 |
no test coverage detected