My slstatus configuration
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

uptime.c 297 B

123456789101112131415161718
  1. /* See LICENSE file for copyright and license details. */
  2. #include <sys/sysinfo.h>
  3. #include "../util.h"
  4. const char *
  5. uptime(void)
  6. {
  7. struct sysinfo info;
  8. int h = 0;
  9. int m = 0;
  10. sysinfo(&info);
  11. h = info.uptime / 3600;
  12. m = (info.uptime - h * 3600 ) / 60;
  13. return bprintf("%dh %dm", h, m);
  14. }