计算干支纪日
()
| 347 | * 计算干支纪日 |
| 348 | */ |
| 349 | private void computeDay() { |
| 350 | Solar noon = Solar.fromYmdHms(solar.getYear(), solar.getMonth(), solar.getDay(), 12, 0, 0); |
| 351 | int offset = (int) noon.getJulianDay() - 11; |
| 352 | dayGanIndex = offset % 10; |
| 353 | dayZhiIndex = offset % 12; |
| 354 | |
| 355 | int dayGanExact = dayGanIndex; |
| 356 | int dayZhiExact = dayZhiIndex; |
| 357 | |
| 358 | // 八字流派2,晚子时(夜子/子夜)日柱算当天 |
| 359 | dayGanIndexExact2 = dayGanExact; |
| 360 | dayZhiIndexExact2 = dayZhiExact; |
| 361 | |
| 362 | // 八字流派1,晚子时(夜子/子夜)日柱算明天 |
| 363 | String hm = (hour < 10 ? "0" : "") + hour + ":" + (minute < 10 ? "0" : "") + minute; |
| 364 | if (hm.compareTo("23:00") >= 0 && hm.compareTo("23:59") <= 0) { |
| 365 | dayGanExact++; |
| 366 | if (dayGanExact >= 10) { |
| 367 | dayGanExact -= 10; |
| 368 | } |
| 369 | dayZhiExact++; |
| 370 | if (dayZhiExact >= 12) { |
| 371 | dayZhiExact -= 12; |
| 372 | } |
| 373 | } |
| 374 | |
| 375 | dayGanIndexExact = dayGanExact; |
| 376 | dayZhiIndexExact = dayZhiExact; |
| 377 | } |
| 378 | |
| 379 | /** |
| 380 | * 计算干支纪时 |
no test coverage detected