A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita audio rust zig deno mpris rockbox mpd
at master 58 lines 1.8 kB view raw
1/*************************************************************************** 2 * __________ __ ___. 3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 * \/ \/ \/ \/ \/ 8 * $Id$ 9 * 10 * Copyright (C) 2002 by Linus Nielsen Feltzing 11 * 12 * This program is free software; you can redistribute it and/or 13 * modify it under the terms of the GNU General Public License 14 * as published by the Free Software Foundation; either version 2 15 * of the License, or (at your option) any later version. 16 * 17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 18 * KIND, either express or implied. 19 * 20 ****************************************************************************/ 21 22 23#include <time.h> 24#include "config.h" 25 26/* mktime() code taken from lynx-2.8.5 source, written 27 by Philippe De Muyter <phdm@macqel.be> */ 28time_t mktime(struct tm *t) 29{ 30 short month, year; 31 time_t result; 32 static int m_to_d[12] = 33 {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334}; 34 35 month = t->tm_mon; 36 year = t->tm_year + month / 12 + 1900; 37 month %= 12; 38 if (month < 0) 39 { 40 year -= 1; 41 month += 12; 42 } 43 result = (year - 1970) * 365 + m_to_d[month]; 44 if (month <= 1) 45 year -= 1; 46 result += (year - 1968) / 4; 47 result -= (year - 1900) / 100; 48 result += (year - 1600) / 400; 49 result += t->tm_mday; 50 result -= 1; 51 result *= 24; 52 result += t->tm_hour; 53 result *= 60; 54 result += t->tm_min; 55 result *= 60; 56 result += t->tm_sec; 57 return(result); 58}