KOpeningHours

easter.cpp
1/*
2 SPDX-FileCopyrightText: 2020 Volker Krause <vkrause@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#include "easter_p.h"
8
9#include <QDate>
10
11using namespace KOpeningHours;
12
13QDate Easter::easterDate(int year)
14{
15 // algorithm from KHolidays
16 const int g = year % 19;
17 const int c = year / 100;
18 const int h = (c - (c / 4) - (((8 * c) + 13) / 25) + (19 * g) + 15) % 30;
19 const int i = h - ((h / 28) * (1 - ((29 / (h + 1)) * ((21 - g) / 11))));
20 const int j = (year + (year / 4) + i + 2 - c + (c / 4)) % 7;
21 const int l = i - j;
22 const int month = 3 + ((l + 40) / 44);
23 const int day = l + 28 - (31 * (month / 4));
24
25 return QDate(year, month, day);
26}
OSM opening hours parsing and evaluation.
Definition display.h:16
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 27 2024 11:56:22 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.