Counter Strike : Global Offensive Source Code
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.

52 lines
968 B

  1. //===== Copyright � 1996-2005, Valve Corporation, All rights reserved. ======//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //
  7. //===========================================================================//
  8. #include <stdlib.h>
  9. #include <string.h>
  10. #include "tier1/strtools.h"
  11. // char *date = "Oct 24 1996";
  12. char *date = __DATE__ ;
  13. char *mon[12] =
  14. { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
  15. char mond[12] =
  16. { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
  17. // returns days since Oct 24 1996
  18. int build_number( void )
  19. {
  20. int m = 0;
  21. int d = 0;
  22. int y = 0;
  23. static int b = 0;
  24. if (b != 0)
  25. return b;
  26. for (m = 0; m < 11; m++)
  27. {
  28. if ( Q_strnicmp( &date[0], mon[m], 3 ) == 0 )
  29. break;
  30. d += mond[m];
  31. }
  32. d += atoi( &date[4] ) - 1;
  33. y = atoi( &date[7] ) - 1900;
  34. b = d + (int)((y - 1) * 365.25);
  35. if (((y % 4) == 0) && m > 1)
  36. {
  37. b += 1;
  38. }
  39. b -= 34995; // Oct 24 1996
  40. return b;
  41. }