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.
 
 
 
 

21 lines
321 B

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