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.

36 lines
793B

  1. #ifndef _UTIL_H
  2. #define _UTIL_H
  3. #include <stdint.h>
  4. #include <stddef.h>
  5. #include <stdbool.h>
  6. /*
  7. * Convert bytes to a hex string
  8. * out needs to be at least (bytes_len * 2 + 1) bytes
  9. */
  10. void util_byte2hex(const uint8_t* bytes, size_t bytes_len,
  11. bool uppercase, char* out);
  12. /*
  13. * Return the user's home directory
  14. */
  15. const char *util_get_home();
  16. /*
  17. * Return the filename part of the path
  18. * This will return a pointer in fullpath
  19. * !! ONLY WORKS FOR FILES !!
  20. */
  21. char *util_basename(const char *fullpath);
  22. /*
  23. * Calculate the difference between 2 timespec structs in miliseconds
  24. *
  25. * future cannot be more in the past than past
  26. * if that makes any sense
  27. */
  28. uint64_t util_timespec_diff(const struct timespec *past,
  29. const struct timespec *future);
  30. #endif /* _UTIL_H */