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.
 
 
 
 

25 rivejä
380 B

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