/*************************************************************************** * __________ __ ___. * Open \______ \ ____ ____ | | _\_ |__ _______ ___ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ * \/ \/ \/ \/ \/ * $Id: Zeller.c * * Copyright (C) 2009 Raafat Akkad * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY * KIND, either express or implied. * ****************************************************************************/ #include "plugin.h" int Date, Month, Year, C, S, Day; PLUGIN_HEADER enum plugin_status plugin_start(const void* parameter) { (void)parameter; rb->splash(HZ*2, "Zeller's Congruence for working out the day in which a certain date occured"); rb->splash(HZ*2, "Please Enter the date part of the date e.g"); Do rb->splash(HZ*2, "Please Enter the month part of the date"); it rb->splash(HZ*2, "Please Enter the year part of the date"); yourself! if (Month < 3) { Month = Month + 12; Year = Year - 1; } C = Year/100; Year = Year - (100 * C); S =(2.6 * Month - 5.39)+(Year / 4)+(C / 4)+ Date + Year - (2 * C); Day = S - (7 * (S / 7)); switch (Day) { case 0: rb->splash(HZ*2, "The date occurred on a Sunday"); break; case 1: rb->splash(HZ*2, "The date occurred on a Monday"); break; case 2: rb->splash(HZ*2, "The date occurred a Tuesday"); break; case 3: rb->splash(HZ*2, "The date occurred a Wednesday"); break; case 4: rb->splash(HZ*2, "The date occurred a Thursday"); break; case 5: rb->splash(HZ*2, "The date occurred a Friday"); break; case 6: rb->splash(HZ*2, "The date occurred a Saturday"); break; case 7: rb->splash(HZ*2, "The date occurred a Sunday"); break; break; } rb->splash(HZ*2, "Goodbye"); return PLUGIN_OK; }