3 * Copyright (c) 2006 acmesystems.it - john@acmesystems.it
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA02111-1307USA
19 * Feedback, Bugs... info@acmesystems.it
30 static MP3_PLAYTIME *mp3_playtime;
32 void sig_alarm_handler(int sig){
34 mp3_playtime->playtime++;
35 mp3_playtime->playtime_secs++;
36 if(mp3_playtime->playtime_secs > 59){
37 mp3_playtime->playtime_mins++;
38 mp3_playtime->playtime_secs = 0;
40 state_generic_event(MP3_EVENT_GENERIC_PLAYTIME, 0, NULL);
43 void mp3_playtime_init(MP3_PLAYTIME *playtime){
44 mp3_playtime = playtime;
45 signal(SIGALRM, sig_alarm_handler);
48 void mp3_playtime_start(void){
49 mp3_playtime->playtime = 0;
50 mp3_playtime->playtime_secs = 0;
51 mp3_playtime->playtime_mins = 0;
53 state_generic_event(MP3_EVENT_GENERIC_PLAYTIME, 0, NULL);
56 void mp3_playtime_stop(void){
58 mp3_playtime->playtime = 0;
59 mp3_playtime->playtime_secs = 0;
60 mp3_playtime->playtime_mins = 0;