• Skip to content
  • Skip to link menu
KDE 4.6 API Reference
  • KDE API Reference
  • kdelibs
  • KDE Home
  • Contact Us
 

KDECore

kcalendarsystemgregorianproleptic.cpp

Go to the documentation of this file.
00001 /*
00002     Copyright 2009, 2010 John Layt <john@layt.net>
00003 
00004     This library is free software; you can redistribute it and/or
00005     modify it under the terms of the GNU Library General Public
00006     License as published by the Free Software Foundation; either
00007     version 2 of the License, or (at your option) any later version.
00008 
00009     This library is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012     Library General Public License for more details.
00013 
00014     You should have received a copy of the GNU Library General Public License
00015     along with this library; see the file COPYING.LIB.  If not, write to
00016     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017     Boston, MA 02110-1301, USA.
00018 */
00019 
00020 // Derived gregorian kde calendar class
00021 
00022 #include "kcalendarsystemgregorianproleptic_p.h"
00023 #include "kcalendarsystemgregorianprolepticprivate_p.h"
00024 #include "kcalendarera_p.h"
00025 
00026 #include "kdebug.h"
00027 #include "klocale.h"
00028 #include "kglobal.h"
00029 #include "kconfiggroup.h"
00030 
00031 #include <QtCore/QDate>
00032 #include <QtCore/QCharRef>
00033 
00034 // Shared d pointer base class definitions
00035 
00036 KCalendarSystemGregorianProlepticPrivate::KCalendarSystemGregorianProlepticPrivate( KCalendarSystemGregorianProleptic *q )
00037                                          :KCalendarSystemPrivate( q )
00038 {
00039 }
00040 
00041 KCalendarSystemGregorianProlepticPrivate::~KCalendarSystemGregorianProlepticPrivate()
00042 {
00043 }
00044 
00045 KLocale::CalendarSystem KCalendarSystemGregorianProlepticPrivate::calendarSystem() const
00046 {
00047     return KLocale::GregorianCalendar;
00048 }
00049 
00050 // Dummy version using Gregorian as an example
00051 // This method MUST be re-implemented in any new Calendar System
00052 void KCalendarSystemGregorianProlepticPrivate::loadDefaultEraList()
00053 {
00054     QString name, shortName, format;
00055 
00056     KConfigGroup cg( config(), QString::fromLatin1( "KCalendarSystem %1" ).arg( q->calendarType() ) );
00057     m_useCommonEra = cg.readEntry( "UseCommonEra", false );
00058 
00059     if ( m_useCommonEra ) {
00060         name = i18nc( "Calendar Era: Gregorian Common Era, years < 0, LongFormat", "Before Common Era" );
00061         shortName = i18nc( "Calendar Era: Gregorian Common Era, years < 0, ShortFormat", "BCE" );
00062     } else {
00063         name = i18nc( "Calendar Era: Gregorian Christian Era, years < 0, LongFormat", "Before Christ" );
00064         shortName = i18nc( "Calendar Era: Gregorian Christian Era, years < 0, ShortFormat", "BC" );
00065     }
00066     format = i18nc( "(kdedt-format) Gregorian, BC, full era year format used for %EY, e.g. 2000 BC", "%Ey %EC" );
00067     addEra( '-', 1, q->epoch().addDays( -1 ), -1, q->earliestValidDate(), name, shortName, format );
00068 
00069     if ( m_useCommonEra ) {
00070         name = i18nc( "Calendar Era: Gregorian Common Era, years > 0, LongFormat", "Common Era" );
00071         shortName = i18nc( "Calendar Era: Gregorian Common Era, years > 0, ShortFormat", "CE" );
00072     } else {
00073         name = i18nc( "Calendar Era: Gregorian Christian Era, years > 0, LongFormat", "Anno Domini" );
00074         shortName = i18nc( "Calendar Era: Gregorian Christian Era, years > 0, ShortFormat", "AD" );
00075     }
00076     format = i18nc( "(kdedt-format) Gregorian, AD, full era year format used for %EY, e.g. 2000 AD", "%Ey %EC" );
00077     addEra( '+', 1, q->epoch(), 1, q->latestValidDate(), name, shortName, format );
00078 }
00079 
00080 int KCalendarSystemGregorianProlepticPrivate::monthsInYear( int year ) const
00081 {
00082     Q_UNUSED( year )
00083     return 12;
00084 }
00085 
00086 int KCalendarSystemGregorianProlepticPrivate::daysInMonth( int year, int month ) const
00087 {
00088     if ( month == 2 ) {
00089         if ( isLeapYear( year ) ) {
00090             return 29;
00091         } else {
00092             return 28;
00093         }
00094     }
00095 
00096     if ( month == 4 || month == 6 || month == 9 || month == 11 ) {
00097         return 30;
00098     }
00099 
00100     return 31;
00101 }
00102 
00103 int KCalendarSystemGregorianProlepticPrivate::daysInYear( int year ) const
00104 {
00105     if ( isLeapYear( year ) ) {
00106         return 366;
00107     } else {
00108         return 365;
00109     }
00110 }
00111 
00112 int KCalendarSystemGregorianProlepticPrivate::daysInWeek() const
00113 {
00114     return 7;
00115 }
00116 
00117 bool KCalendarSystemGregorianProlepticPrivate::isLeapYear( int year ) const
00118 {
00119     if ( !hasYearZero() && year < 1 ) {
00120         year = year + 1;
00121     }
00122 
00123     if ( year % 4 == 0 ) {
00124         if ( year % 100 != 0 ) {
00125             return true;
00126         } else if ( year % 400 == 0 ) {
00127             return true;
00128         }
00129     }
00130 
00131     return false;
00132 }
00133 
00134 bool KCalendarSystemGregorianProlepticPrivate::hasLeapMonths() const
00135 {
00136     return false;
00137 }
00138 
00139 bool KCalendarSystemGregorianProlepticPrivate::hasYearZero() const
00140 {
00141     return false;
00142 }
00143 
00144 int KCalendarSystemGregorianProlepticPrivate::maxDaysInWeek() const
00145 {
00146     return 7;
00147 }
00148 
00149 int KCalendarSystemGregorianProlepticPrivate::maxMonthsInYear() const
00150 {
00151     return 12;
00152 }
00153 
00154 int KCalendarSystemGregorianProlepticPrivate::earliestValidYear() const
00155 {
00156     return -4713;
00157 }
00158 
00159 int KCalendarSystemGregorianProlepticPrivate::latestValidYear() const
00160 {
00161     return 9999;
00162 }
00163 
00164 
00165 KCalendarSystemGregorianProleptic::KCalendarSystemGregorianProleptic( const KLocale *locale )
00166                                  : KCalendarSystem( *new KCalendarSystemGregorianProlepticPrivate( this ), KSharedConfig::Ptr(), locale ),
00167                                  dont_use( 0 )
00168 {
00169     d_ptr->loadConfig( calendarType() );
00170 }
00171 
00172 KCalendarSystemGregorianProleptic::KCalendarSystemGregorianProleptic( const KSharedConfig::Ptr config,
00173                                                                       const KLocale *locale )
00174                                  : KCalendarSystem( *new KCalendarSystemGregorianProlepticPrivate( this ), config, locale ),
00175                                    dont_use( 0 )
00176 {
00177     d_ptr->loadConfig( calendarType() );
00178 }
00179 
00180 KCalendarSystemGregorianProleptic::KCalendarSystemGregorianProleptic( KCalendarSystemGregorianProlepticPrivate &dd,
00181                                                                       const KSharedConfig::Ptr config,
00182                                                                       const KLocale *locale )
00183                                  : KCalendarSystem( dd, config, locale ),
00184                                    dont_use( 0 )
00185 {
00186     d_ptr->loadConfig( calendarType() );
00187 }
00188 
00189 KCalendarSystemGregorianProleptic::~KCalendarSystemGregorianProleptic()
00190 {
00191     delete dont_use;
00192 }
00193 
00194 QString KCalendarSystemGregorianProleptic::calendarType() const
00195 {
00196     return QLatin1String( "gregorian-proleptic" );
00197 }
00198 
00199 QDate KCalendarSystemGregorianProleptic::epoch() const
00200 {
00201     return QDate::fromJulianDay( 1721426 );
00202 }
00203 
00204 QDate KCalendarSystemGregorianProleptic::earliestValidDate() const
00205 {
00206     // Gregorian 1 Jan 4713 BC, no year zero
00207     return QDate::fromJulianDay( 38 );
00208 }
00209 
00210 QDate KCalendarSystemGregorianProleptic::latestValidDate() const
00211 {
00212     // Set to last day of year 9999 until confirm date formats & widgets support > 9999
00213     // In Gregorian this is 9999-12-31, which is  is jd 5373484
00214     // Can't call setDate( 9999, 12, 31 ) as it creates circular reference!
00215     return QDate::fromJulianDay( 5373484 );
00216 }
00217 
00218 bool KCalendarSystemGregorianProleptic::isValid( int year, int month, int day ) const
00219 {
00220     return KCalendarSystem::isValid( year, month, day );
00221 }
00222 
00223 bool KCalendarSystemGregorianProleptic::isValid( const QDate &date ) const
00224 {
00225     return KCalendarSystem::isValid( date );
00226 }
00227 
00228 bool KCalendarSystemGregorianProleptic::setDate( QDate &date, int year, int month, int day ) const
00229 {
00230     return KCalendarSystem::setDate( date, year, month, day );
00231 }
00232 
00233 // Deprecated
00234 bool KCalendarSystemGregorianProleptic::setYMD( QDate &date, int year, int month, int day ) const
00235 {
00236     return KCalendarSystem::setYMD( date, year, month, day );
00237 }
00238 
00239 int KCalendarSystemGregorianProleptic::year( const QDate &date ) const
00240 {
00241     return KCalendarSystem::year( date );
00242 }
00243 
00244 int KCalendarSystemGregorianProleptic::month( const QDate &date ) const
00245 {
00246     return KCalendarSystem::month( date );
00247 }
00248 
00249 int KCalendarSystemGregorianProleptic::day( const QDate &date ) const
00250 {
00251     return KCalendarSystem::day( date );
00252 }
00253 
00254 QDate KCalendarSystemGregorianProleptic::addYears( const QDate &date, int nyears ) const
00255 {
00256     return KCalendarSystem::addYears( date, nyears );
00257 }
00258 
00259 QDate KCalendarSystemGregorianProleptic::addMonths( const QDate &date, int nmonths ) const
00260 {
00261     return KCalendarSystem::addMonths( date, nmonths );
00262 }
00263 
00264 QDate KCalendarSystemGregorianProleptic::addDays( const QDate &date, int ndays ) const
00265 {
00266     return KCalendarSystem::addDays( date, ndays );
00267 }
00268 
00269 int KCalendarSystemGregorianProleptic::monthsInYear( const QDate &date ) const
00270 {
00271     return KCalendarSystem::monthsInYear( date );
00272 }
00273 
00274 int KCalendarSystemGregorianProleptic::weeksInYear( const QDate &date ) const
00275 {
00276     return KCalendarSystem::weeksInYear( date );
00277 }
00278 
00279 int KCalendarSystemGregorianProleptic::weeksInYear( int year ) const
00280 {
00281     return KCalendarSystem::weeksInYear( year );
00282 }
00283 
00284 int KCalendarSystemGregorianProleptic::daysInYear( const QDate &date ) const
00285 {
00286     return KCalendarSystem::daysInYear( date );
00287 }
00288 
00289 int KCalendarSystemGregorianProleptic::daysInMonth( const QDate &date ) const
00290 {
00291     return KCalendarSystem::daysInMonth( date );
00292 }
00293 
00294 int KCalendarSystemGregorianProleptic::daysInWeek( const QDate &date ) const
00295 {
00296     return KCalendarSystem::daysInWeek( date );
00297 }
00298 
00299 int KCalendarSystemGregorianProleptic::dayOfYear( const QDate &date ) const
00300 {
00301     return KCalendarSystem::dayOfYear( date );
00302 }
00303 
00304 int KCalendarSystemGregorianProleptic::dayOfWeek( const QDate &date ) const
00305 {
00306     return KCalendarSystem::dayOfWeek( date );
00307 }
00308 
00309 int KCalendarSystemGregorianProleptic::weekNumber( const QDate &date, int * yearNum ) const
00310 {
00311     return KCalendarSystem::weekNumber( date, yearNum );
00312 }
00313 
00314 bool KCalendarSystemGregorianProleptic::isLeapYear( int year ) const
00315 {
00316     return KCalendarSystem::isLeapYear( year );
00317 }
00318 
00319 bool KCalendarSystemGregorianProleptic::isLeapYear( const QDate &date ) const
00320 {
00321     return KCalendarSystem::isLeapYear( date );
00322 }
00323 
00324 QString KCalendarSystemGregorianProleptic::monthName( int month, int year, MonthNameFormat format ) const
00325 {
00326     Q_UNUSED( year );
00327 
00328     if ( format == ShortNamePossessive ) {
00329         switch ( month ) {
00330         case 1:
00331             return ki18nc( "of January",   "of Jan" ).toString( locale() );
00332         case 2:
00333             return ki18nc( "of February",  "of Feb" ).toString( locale() );
00334         case 3:
00335             return ki18nc( "of March",     "of Mar" ).toString( locale() );
00336         case 4:
00337             return ki18nc( "of April",     "of Apr" ).toString( locale() );
00338         case 5:
00339             return ki18nc( "of May short", "of May" ).toString( locale() );
00340         case 6:
00341             return ki18nc( "of June",      "of Jun" ).toString( locale() );
00342         case 7:
00343             return ki18nc( "of July",      "of Jul" ).toString( locale() );
00344         case 8:
00345             return ki18nc( "of August",    "of Aug" ).toString( locale() );
00346         case 9:
00347             return ki18nc( "of September", "of Sep" ).toString( locale() );
00348         case 10:
00349             return ki18nc( "of October",   "of Oct" ).toString( locale() );
00350         case 11:
00351             return ki18nc( "of November",  "of Nov" ).toString( locale() );
00352         case 12:
00353             return ki18nc( "of December",  "of Dec" ).toString( locale() );
00354         default:
00355             return QString();
00356         }
00357     }
00358 
00359     if ( format == LongNamePossessive ) {
00360         switch ( month ) {
00361         case 1:
00362             return ki18n( "of January" ).toString( locale() );
00363         case 2:
00364             return ki18n( "of February" ).toString( locale() );
00365         case 3:
00366             return ki18n( "of March" ).toString( locale() );
00367         case 4:
00368             return ki18n( "of April" ).toString( locale() );
00369         case 5:
00370             return ki18nc( "of May long", "of May" ).toString( locale() );
00371         case 6:
00372             return ki18n( "of June" ).toString( locale() );
00373         case 7:
00374             return ki18n( "of July" ).toString( locale() );
00375         case 8:
00376             return ki18n( "of August" ).toString( locale() );
00377         case 9:
00378             return ki18n( "of September" ).toString( locale() );
00379         case 10:
00380             return ki18n( "of October" ).toString( locale() );
00381         case 11:
00382             return ki18n( "of November" ).toString( locale() );
00383         case 12:
00384             return ki18n( "of December" ).toString( locale() );
00385         default:
00386             return QString();
00387         }
00388     }
00389 
00390     if ( format == ShortName ) {
00391         switch ( month ) {
00392         case 1:
00393             return ki18nc( "January", "Jan" ).toString( locale() );
00394         case 2:
00395             return ki18nc( "February", "Feb" ).toString( locale() );
00396         case 3:
00397             return ki18nc( "March", "Mar" ).toString( locale() );
00398         case 4:
00399             return ki18nc( "April", "Apr" ).toString( locale() );
00400         case 5:
00401             return ki18nc( "May short", "May" ).toString( locale() );
00402         case 6:
00403             return ki18nc( "June", "Jun" ).toString( locale() );
00404         case 7:
00405             return ki18nc( "July", "Jul" ).toString( locale() );
00406         case 8:
00407             return ki18nc( "August", "Aug" ).toString( locale() );
00408         case 9:
00409             return ki18nc( "September", "Sep" ).toString( locale() );
00410         case 10:
00411             return ki18nc( "October", "Oct" ).toString( locale() );
00412         case 11:
00413             return ki18nc( "November", "Nov" ).toString( locale() );
00414         case 12:
00415             return ki18nc( "December", "Dec" ).toString( locale() );
00416         default:
00417             return QString();
00418         }
00419     }
00420 
00421     // Default to LongName
00422     switch ( month ) {
00423     case 1:
00424         return ki18n( "January" ).toString( locale() );
00425     case 2:
00426         return ki18n( "February" ).toString( locale() );
00427     case 3:
00428         return ki18nc( "March long", "March" ).toString( locale() );
00429     case 4:
00430         return ki18n( "April" ).toString( locale() );
00431     case 5:
00432         return ki18nc( "May long", "May" ).toString( locale() );
00433     case 6:
00434         return ki18n( "June" ).toString( locale() );
00435     case 7:
00436         return ki18n( "July" ).toString( locale() );
00437     case 8:
00438         return ki18nc( "August long", "August" ).toString( locale() );
00439     case 9:
00440         return ki18n( "September" ).toString( locale() );
00441     case 10:
00442         return ki18n( "October" ).toString( locale() );
00443     case 11:
00444         return ki18n( "November" ).toString( locale() );
00445     case 12:
00446         return ki18n( "December" ).toString( locale() );
00447     default:
00448         return QString();
00449     }
00450 }
00451 
00452 QString KCalendarSystemGregorianProleptic::monthName( const QDate &date, MonthNameFormat format ) const
00453 {
00454     return KCalendarSystem::monthName( date, format );
00455 }
00456 
00457 
00458 QString KCalendarSystemGregorianProleptic::weekDayName( int weekDay, WeekDayNameFormat format ) const
00459 {
00460     if ( format == ShortDayName ) {
00461         switch ( weekDay ) {
00462         case 1:  return ki18nc( "Monday",    "Mon" ).toString( locale() );
00463         case 2:  return ki18nc( "Tuesday",   "Tue" ).toString( locale() );
00464         case 3:  return ki18nc( "Wednesday", "Wed" ).toString( locale() );
00465         case 4:  return ki18nc( "Thursday",  "Thu" ).toString( locale() );
00466         case 5:  return ki18nc( "Friday",    "Fri" ).toString( locale() );
00467         case 6:  return ki18nc( "Saturday",  "Sat" ).toString( locale() );
00468         case 7:  return ki18nc( "Sunday",    "Sun" ).toString( locale() );
00469         default: return QString();
00470         }
00471     }
00472 
00473     switch ( weekDay ) {
00474     case 1:  return ki18n( "Monday" ).toString( locale() );
00475     case 2:  return ki18n( "Tuesday" ).toString( locale() );
00476     case 3:  return ki18n( "Wednesday" ).toString( locale() );
00477     case 4:  return ki18n( "Thursday" ).toString( locale() );
00478     case 5:  return ki18n( "Friday" ).toString( locale() );
00479     case 6:  return ki18n( "Saturday" ).toString( locale() );
00480     case 7:  return ki18n( "Sunday" ).toString( locale() );
00481     default: return QString();
00482     }
00483 }
00484 
00485 QString KCalendarSystemGregorianProleptic::weekDayName( const QDate &date, WeekDayNameFormat format ) const
00486 {
00487     return KCalendarSystem::weekDayName( date, format );
00488 }
00489 
00490 QString KCalendarSystemGregorianProleptic::yearString( const QDate &pDate, StringFormat format ) const
00491 {
00492     return KCalendarSystem::yearString( pDate, format );
00493 }
00494 
00495 QString KCalendarSystemGregorianProleptic::monthString( const QDate &pDate, StringFormat format ) const
00496 {
00497     return KCalendarSystem::monthString( pDate, format );
00498 }
00499 
00500 QString KCalendarSystemGregorianProleptic::dayString( const QDate &pDate, StringFormat format ) const
00501 {
00502     return KCalendarSystem::dayString( pDate, format );
00503 }
00504 
00505 int KCalendarSystemGregorianProleptic::yearStringToInteger( const QString &sNum, int &iLength ) const
00506 {
00507     return KCalendarSystem::yearStringToInteger( sNum, iLength );
00508 }
00509 
00510 int KCalendarSystemGregorianProleptic::monthStringToInteger( const QString &sNum, int &iLength ) const
00511 {
00512     return KCalendarSystem::monthStringToInteger( sNum, iLength );
00513 }
00514 
00515 int KCalendarSystemGregorianProleptic::dayStringToInteger( const QString &sNum, int &iLength ) const
00516 {
00517     return KCalendarSystem::dayStringToInteger( sNum, iLength );
00518 }
00519 
00520 QString KCalendarSystemGregorianProleptic::formatDate( const QDate &date, KLocale::DateFormat format ) const
00521 {
00522     return KCalendarSystem::formatDate( date, format );
00523 }
00524 
00525 QDate KCalendarSystemGregorianProleptic::readDate( const QString &str, bool *ok ) const
00526 {
00527     return KCalendarSystem::readDate( str, ok );
00528 }
00529 
00530 QDate KCalendarSystemGregorianProleptic::readDate( const QString &intstr, const QString &fmt, bool *ok ) const
00531 {
00532     return KCalendarSystem::readDate( intstr, fmt, ok );
00533 }
00534 
00535 QDate KCalendarSystemGregorianProleptic::readDate( const QString &str, KLocale::ReadDateFlags flags, bool *ok ) const
00536 {
00537     return KCalendarSystem::readDate( str, flags, ok );
00538 }
00539 
00540 int KCalendarSystemGregorianProleptic::weekStartDay() const
00541 {
00542     return KCalendarSystem::weekStartDay();
00543 }
00544 
00545 int KCalendarSystemGregorianProleptic::weekDayOfPray() const
00546 {
00547     return 7; // sunday
00548 }
00549 
00550 bool KCalendarSystemGregorianProleptic::isLunar() const
00551 {
00552     return false;
00553 }
00554 
00555 bool KCalendarSystemGregorianProleptic::isLunisolar() const
00556 {
00557     return false;
00558 }
00559 
00560 bool KCalendarSystemGregorianProleptic::isSolar() const
00561 {
00562     return true;
00563 }
00564 
00565 bool KCalendarSystemGregorianProleptic::isProleptic() const
00566 {
00567     return true;
00568 }
00569 
00570 bool KCalendarSystemGregorianProleptic::julianDayToDate( int jd, int &year, int &month, int &day ) const
00571 {
00572     Q_D( const KCalendarSystemGregorianProleptic );
00573 
00574     // Formula from The Calendar FAQ by Claus Tondering
00575     // http://www.tondering.dk/claus/cal/node3.html#SECTION003161000000000000000
00576     // NOTE: Coded from scratch from mathematical formulas, not copied from
00577     // the Boost licensed source code
00578 
00579     int a = jd + 32044;
00580     int b = ( ( 4 * a ) + 3 ) / 146097;
00581     int c = a - ( ( 146097 * b ) / 4 );
00582     int dd = ( ( 4 * c ) + 3 ) / 1461;
00583     int e = c - ( ( 1461 * dd ) / 4 );
00584     int m = ( ( 5 * e ) + 2 ) / 153;
00585     day = e - ( ( (153 * m ) + 2 ) / 5 ) + 1;
00586     month = m + 3 - ( 12 * ( m / 10 ) );
00587     year = ( 100 * b ) + dd - 4800 + ( m / 10 );
00588 
00589     // If year is -ve then is BC.  In Gregorian there is no year 0, but the maths
00590     // is easier if we pretend there is, so internally year of 0 = 1BC = -1 outside
00591     // Check for Year 0 support as some Gregorian based calendars do have it, e.g. Thai and ISO
00592     if ( !d->hasYearZero() && year < 1 ) {
00593         year = year - 1;
00594     }
00595     return true;
00596 }
00597 
00598 bool KCalendarSystemGregorianProleptic::dateToJulianDay( int year, int month, int day, int &jd ) const
00599 {
00600     Q_D( const KCalendarSystemGregorianProleptic );
00601 
00602     // Formula from The Calendar FAQ by Claus Tondering
00603     // http://www.tondering.dk/claus/cal/node3.html#SECTION003161000000000000000
00604     // NOTE: Coded from scratch from mathematical formulas, not copied from
00605     // the Boost licensed source code
00606 
00607     // If year is -ve then is BC.  In Gregorian there is no year 0, but the maths
00608     // is easier if we pretend there is, so internally year of -1 = 1BC = 0 internally
00609     // Check for Year 0 support as some Gregorian based calendars do have it, e.g. Thai and ISO
00610     int y;
00611     if ( !d->hasYearZero() && year < 1 ) {
00612         y = year + 1;
00613     } else {
00614         y = year;
00615     }
00616 
00617     int a = ( 14 - month ) / 12;
00618     y = y + 4800 - a;
00619     int m = month + ( 12 * a ) - 3;
00620 
00621     jd = day
00622          + ( ( ( 153 * m ) + 2 ) / 5 )
00623          + ( 365 * y )
00624          + ( y / 4 )
00625          - ( y / 100 )
00626          + ( y / 400 )
00627          - 32045;
00628 
00629     return true;
00630 }

KDECore

Skip menu "KDECore"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.7.3
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal