hversion.h 849 B

12345678910111213141516171819202122232425262728293031
  1. #ifndef H_VERSION_H
  2. #define H_VERSION_H
  3. #include "hdef.h"
  4. #include "htime.h"
  5. #include <stdio.h>
  6. #define VERSION_MAJOR 1
  7. #define VERSION_MINOR 18
  8. #define VERSION_MICRO 5
  9. #define VERSION_PATCH 1
  10. #define VERSION_STRING STRINGIFY(VERSION_MAJOR) "." \
  11. STRINGIFY(VERSION_MINOR) "." \
  12. STRINGIFY(VERSION_MICRO) "." \
  13. STRINGIFY(VERSION_PATCH)
  14. #define VERSION_HEX (VERSION_MAJOR << 24) | (VERSION_MINOR << 16) | (VERSION_MICRO << 8) | VERSION_PATCH
  15. inline const char* get_static_version(){
  16. return VERSION_STRING;
  17. }
  18. inline const char* get_compile_version(){
  19. static char version[16];
  20. static datetime_t dt = get_compile_datetime();
  21. sprintf(version, "%d.%d.%d.%d", VERSION_MAJOR, dt.year%100, dt.month, dt.day);
  22. return version;
  23. }
  24. #endif // H_VERSION_H