A tool for adding anime to your anidb list.
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.

32 lines
622B

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include "cmd.h"
  4. #include "uio.h"
  5. #include "api.h"
  6. enum error cmd_server_uptime(void *data)
  7. {
  8. struct api_result r;
  9. int32_t h, m, s;
  10. div_t dt;
  11. if (api_cmd_uptime(&r) != NOERR)
  12. return ERR_CMD_FAILED;
  13. if (r.code != 208) {
  14. uio_error("VERSION cmd is unsuccesful: %hu", r.code);
  15. return ERR_CMD_FAILED;
  16. }
  17. dt = div(r.uptime.ms, 1000*60*60);
  18. h = dt.quot;
  19. dt = div(dt.rem, 1000*60);
  20. m = dt.quot;
  21. dt = div(dt.rem, 1000);
  22. s = dt.quot;
  23. printf("up %d hours, %d minutes, %d seconds\n", h, m, s);
  24. return NOERR;
  25. }