1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-12-25 12:10:03 +00:00

Add support for time_in_seconds configuration setting

This commit is contained in:
Nikolas Garofil 2009-11-18 20:07:47 +01:00
parent 4cfb042df9
commit 8f42831a62
2 changed files with 25 additions and 2 deletions

View File

@ -794,6 +794,17 @@
cannot be smaller than the default value of 256 bytes. cannot be smaller than the default value of 256 bytes.
<para /></listitem> <para /></listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term>
<command>
<option>time_in_seconds</option>
</command>
</term>
<listitem>If true, variables that output times output a number
that represents seconds. This doesn't affect $time, $tztime and
$utime
<para /></listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term> <term>
<command> <command>

View File

@ -167,6 +167,7 @@ int top_running;
#endif #endif
static unsigned int top_name_width = 15; static unsigned int top_name_width = 15;
int output_methods; int output_methods;
char times_in_seconds = 0;
static int extra_newline; static int extra_newline;
enum x_initialiser_state x_initialised = NO; enum x_initialiser_state x_initialised = NO;
static volatile int g_signal_pending; static volatile int g_signal_pending;
@ -1978,10 +1979,18 @@ void generate_text_internal(char *p, int p_max_size,
} }
#endif /* X11 */ #endif /* X11 */
OBJ(uptime_short) { OBJ(uptime_short) {
format_seconds_short(p, p_max_size, (int) cur->uptime); if(times_in_seconds) {
snprintf(p, p_max_size, "%d", (int) cur->uptime);
} else {
format_seconds_short(p, p_max_size, (int) cur->uptime);
}
} }
OBJ(uptime) { OBJ(uptime) {
format_seconds(p, p_max_size, (int) cur->uptime); if(times_in_seconds) {
snprintf(p, p_max_size, "%d", (int) cur->uptime);
} else {
format_seconds(p, p_max_size, (int) cur->uptime);
}
} }
#ifdef __linux__ #ifdef __linux__
OBJ(user_names) { OBJ(user_names) {
@ -4947,6 +4956,9 @@ char load_config_file(const char *f)
draw_outline = string_to_bool(value); draw_outline = string_to_bool(value);
} }
#endif /* X11 */ #endif /* X11 */
CONF("times_in_seconds") {
times_in_seconds = string_to_bool(value);
}
CONF("out_to_console") { CONF("out_to_console") {
if(string_to_bool(value)) { if(string_to_bool(value)) {
output_methods |= TO_STDOUT; output_methods |= TO_STDOUT;