Changeset View
Changeset View
Standalone View
Standalone View
src/parsers/qcalendarsystem.cpp
Show First 20 Lines • Show All 392 Lines • ▼ Show 20 Line(s) | 390 | { | |||
---|---|---|---|---|---|
393 | switch (calendarSystem()) { | 393 | switch (calendarSystem()) { | ||
394 | 394 | | |||
395 | case QCalendarSystem::GregorianCalendar: | 395 | case QCalendarSystem::GregorianCalendar: | ||
396 | case QCalendarSystem::ISO8601Calendar: | 396 | case QCalendarSystem::ISO8601Calendar: | ||
397 | case QCalendarSystem::JapaneseCalendar: | 397 | case QCalendarSystem::JapaneseCalendar: | ||
398 | case QCalendarSystem::ROCCalendar: | 398 | case QCalendarSystem::ROCCalendar: | ||
399 | case QCalendarSystem::ThaiCalendar: { | 399 | case QCalendarSystem::ThaiCalendar: { | ||
400 | // Formula from The Calendar FAQ by Claus Tondering | 400 | // Formula from The Calendar FAQ by Claus Tondering | ||
401 | // http://www.tondering.dk/claus/cal/node3.html#SECTION003161000000000000000 | 401 | // https://www.tondering.dk/claus/calendar.html | ||
402 | qint64 a = jd + 32044; | 402 | qint64 a = jd + 32044; | ||
403 | qint64 b = ((4 * a) + 3) / 146097; | 403 | qint64 b = ((4 * a) + 3) / 146097; | ||
404 | qint64 c = a - ((146097 * b) / 4); | 404 | qint64 c = a - ((146097 * b) / 4); | ||
405 | qint64 d = ((4 * c) + 3) / 1461; | 405 | qint64 d = ((4 * c) + 3) / 1461; | ||
406 | qint64 e = c - ((1461 * d) / 4); | 406 | qint64 e = c - ((1461 * d) / 4); | ||
407 | qint64 m = ((5 * e) + 2) / 153; | 407 | qint64 m = ((5 * e) + 2) / 153; | ||
408 | dd = e - (((153 * m) + 2) / 5) + 1; | 408 | dd = e - (((153 * m) + 2) / 5) + 1; | ||
409 | mm = m + 3 - (12 * (m / 10)); | 409 | mm = m + 3 - (12 * (m / 10)); | ||
▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Line(s) | 444 | case QCalendarSystem::IslamicCivilCalendar: { | |||
453 | yy = (30 * n) + j - 30; | 453 | yy = (30 * n) + j - 30; | ||
454 | mm = (24 * l) / 709; | 454 | mm = (24 * l) / 709; | ||
455 | dd = l - ((709 * mm) / 24); | 455 | dd = l - ((709 * mm) / 24); | ||
456 | break; | 456 | break; | ||
457 | } | 457 | } | ||
458 | 458 | | |||
459 | case QCalendarSystem::JulianCalendar: { | 459 | case QCalendarSystem::JulianCalendar: { | ||
460 | // Formula from The Calendar FAQ by Claus Tondering | 460 | // Formula from The Calendar FAQ by Claus Tondering | ||
461 | // http://www.tondering.dk/claus/cal/node3.html#SECTION003161000000000000000 | 461 | // https://www.tondering.dk/claus/calendar.html | ||
462 | qint64 b = 0; | 462 | qint64 b = 0; | ||
463 | qint64 c = jd + 32082; | 463 | qint64 c = jd + 32082; | ||
464 | qint64 d = ((4 * c) + 3) / 1461; | 464 | qint64 d = ((4 * c) + 3) / 1461; | ||
465 | qint64 e = c - ((1461 * d) / 4); | 465 | qint64 e = c - ((1461 * d) / 4); | ||
466 | qint64 m = ((5 * e) + 2) / 153; | 466 | qint64 m = ((5 * e) + 2) / 153; | ||
467 | dd = e - (((153 * m) + 2) / 5) + 1; | 467 | dd = e - (((153 * m) + 2) / 5) + 1; | ||
468 | mm = m + 3 - (12 * (m / 10)); | 468 | mm = m + 3 - (12 * (m / 10)); | ||
469 | yy = (100 * b) + d - 4800 + (m / 10); | 469 | yy = (100 * b) + d - 4800 + (m / 10); | ||
Show All 34 Lines | 495 | { | |||
504 | switch (calendarSystem()) { | 504 | switch (calendarSystem()) { | ||
505 | 505 | | |||
506 | case QCalendarSystem::GregorianCalendar: | 506 | case QCalendarSystem::GregorianCalendar: | ||
507 | case QCalendarSystem::ISO8601Calendar: | 507 | case QCalendarSystem::ISO8601Calendar: | ||
508 | case QCalendarSystem::JapaneseCalendar: | 508 | case QCalendarSystem::JapaneseCalendar: | ||
509 | case QCalendarSystem::ROCCalendar: | 509 | case QCalendarSystem::ROCCalendar: | ||
510 | case QCalendarSystem::ThaiCalendar: { | 510 | case QCalendarSystem::ThaiCalendar: { | ||
511 | // Formula from The Calendar FAQ by Claus Tondering | 511 | // Formula from The Calendar FAQ by Claus Tondering | ||
512 | // http://www.tondering.dk/claus/cal/node3.html#SECTION003161000000000000000 | 512 | // https://www.tondering.dk/claus/calendar.html | ||
513 | int a = (14 - month) / 12; | 513 | int a = (14 - month) / 12; | ||
514 | year = year + 4800 - a; | 514 | year = year + 4800 - a; | ||
515 | int m = month + (12 * a) - 3; | 515 | int m = month + (12 * a) - 3; | ||
516 | jd = day + | 516 | jd = day + | ||
517 | (((153 * m) + 2) / 5) + | 517 | (((153 * m) + 2) / 5) + | ||
518 | (365 * year) + | 518 | (365 * year) + | ||
519 | (year / 4) - | 519 | (year / 4) - | ||
520 | (year / 100) + | 520 | (year / 100) + | ||
Show All 40 Lines | 557 | jd = (3 + (11 * year)) / 30 + | |||
561 | day + | 561 | day + | ||
562 | epoch() - | 562 | epoch() - | ||
563 | 385; | 563 | 385; | ||
564 | break; | 564 | break; | ||
565 | } | 565 | } | ||
566 | 566 | | |||
567 | case QCalendarSystem::JulianCalendar: { | 567 | case QCalendarSystem::JulianCalendar: { | ||
568 | // Formula from The Calendar FAQ by Claus Tondering | 568 | // Formula from The Calendar FAQ by Claus Tondering | ||
569 | // http://www.tondering.dk/claus/cal/node3.html#SECTION003161000000000000000 | 569 | // https://www.tondering.dk/claus/calendar.html | ||
570 | int a = (14 - month) / 12; | 570 | int a = (14 - month) / 12; | ||
571 | year = year + 4800 - a; | 571 | year = year + 4800 - a; | ||
572 | int m = month + (12 * a) - 3; | 572 | int m = month + (12 * a) - 3; | ||
573 | jd = day + | 573 | jd = day + | ||
574 | (((153 * m) + 2) / 5) + | 574 | (((153 * m) + 2) / 5) + | ||
575 | (365 * year) + | 575 | (365 * year) + | ||
576 | (year / 4) - | 576 | (year / 4) - | ||
577 | 32083; | 577 | 32083; | ||
▲ Show 20 Lines • Show All 694 Lines • Show Last 20 Lines |