equal
deleted
inserted
replaced
28 #include <mcabber/commands.h> |
28 #include <mcabber/commands.h> |
29 #include <mcabber/settings.h> |
29 #include <mcabber/settings.h> |
30 |
30 |
31 #include "config.h" |
31 #include "config.h" |
32 |
32 |
33 #define DESCRIPTION ( "Shows mcabber uptime\nRecognizes option uptime_hz (at load time)." ) |
33 #define DESCRIPTION ( "Shows mcabber uptime." ) |
34 |
34 |
35 module_info_t info_uptime_experimental = { |
35 module_info_t info_uptime_experimental = { |
36 .branch = "experimental", |
36 .branch = "experimental", |
37 .api = 15, |
37 .api = 15, |
38 .version = PROJECT_VERSION, |
38 .version = PROJECT_VERSION, |
184 } |
184 } |
185 g_io_channel_unref (channel); |
185 g_io_channel_unref (channel); |
186 |
186 |
187 g_string_free (line, TRUE); |
187 g_string_free (line, TRUE); |
188 |
188 |
189 guint hz = settings_opt_get_int ("uptime_hz"); |
189 guint hz = sysconf(_SC_CLK_TCK); |
190 if (!hz) |
|
191 hz = sysconf(_SC_CLK_TCK); |
|
192 starttime = kbtime + (mstime / hz); |
190 starttime = kbtime + (mstime / hz); |
193 } else |
191 } else |
194 starttime = time (NULL); |
192 starttime = time (NULL); |
195 |
193 |
196 cmd_add ("uptime", "", 0, 0, do_uptime, NULL); |
194 cmd_add ("uptime", "", 0, 0, do_uptime, NULL); |