wmmixer: 1.9
[dockapps.git] / wmmisc / src / dockapp_utils.h
blobd1273af3febe8a90a1b83769b43e575dfae60ec7
1 /*
2 * wmmisc - WindowMaker Dockapp for monitoring misc. information.
3 * Copyright (C) 2003-2006 Jesse S. (luxorfalls@sbcglobal.net)
5 * wmmisc 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 * wmmisc 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 wmmisc; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 #ifndef __dockapp_utils_h
22 #define __dockapp_utils_h
24 #include <math.h>
26 typedef struct
28 unsigned int users;
29 unsigned int total;
30 unsigned int running;
31 int load[2];
33 float jiffies;
34 int seconds;
35 int minutes;
36 int hours;
37 int days;
38 int weeks;
39 } dockapp_proc_t;
42 * Define some math macros.
45 /* Integer math. */
46 #define GET_SECS( j ) ( ( int ) nearbyint( j ) % 60 )
47 #define GET_MINS( j ) ( ( int ) ( nearbyint( j ) / 60 ) % 60 )
48 #define GET_HRS( j ) ( ( int ) ( nearbyint( j ) / 3600 ) % 24 )
49 #define GET_DAYS( j ) ( ( int ) ( nearbyint( j ) / 86400 ) % 7 )
50 #define GET_WEEKS( j ) ( ( int ) nearbyint( j ) / 604800 )
52 /* Floating-point math. */
53 #define GET_SECS_F( j ) ( fmodf( j, 60 ) )
54 #define GET_MINS_F( j ) ( fmodf( ( j / 60 ), 60 ) )
55 #define GET_HRS_F( j ) ( fmodf( ( j / 3600 ), 24 ) )
56 #define GET_DAYS_F( j ) ( fmodf( ( j / 86400 ), 7 ) )
57 #define GET_WEEKS_F( j ) ( ( float ) j / 604800 )
60 * Function prototypes.
63 dockapp_proc_t dockapp_utils_get_proc( void );
65 void dockapp_utils_get_users( void );
67 int dockapp_utils_get_char( char );
69 #endif /* !__dockapp_utils_h */