Add support for time_in_seconds configuration setting
authorNikolas Garofil <garo@dunaldi.garofil.be>
Wed, 18 Nov 2009 19:07:47 +0000 (20:07 +0100)
committerNikolas Garofil <garo@dunaldi.garofil.be>
Wed, 18 Nov 2009 19:07:47 +0000 (20:07 +0100)
doc/config_settings.xml
src/conky.c

index 3cbe14c..e95f406 100644 (file)
     <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>
+        <term>
+            <command>
                 <option>top_cpu_separate</option>
             </command>
         </term>
index 4c8d0c0..571d398 100644 (file)
@@ -167,6 +167,7 @@ int top_running;
 #endif
 static unsigned int top_name_width = 15;
 int output_methods;
+char times_in_seconds = 0;
 static int extra_newline;
 enum x_initialiser_state x_initialised = NO;
 static volatile int g_signal_pending;
@@ -1978,10 +1979,18 @@ void generate_text_internal(char *p, int p_max_size,
                        }
 #endif /* X11 */
                        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) {
-                               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__
                        OBJ(user_names) {
@@ -4947,6 +4956,9 @@ char load_config_file(const char *f)
                        draw_outline = string_to_bool(value);
                }
 #endif /* X11 */
+               CONF("times_in_seconds") {
+                       times_in_seconds = string_to_bool(value);
+               }
                CONF("out_to_console") {
                        if(string_to_bool(value)) {
                                output_methods |= TO_STDOUT;