Source code of Windows XP (NT5)
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.

54 lines
1018 B

  1. //____________________________________________________________________________
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1995 - 1996.
  5. //
  6. // File: TimeUtil.cxx
  7. //
  8. // Contents:
  9. //
  10. // Classes:
  11. //
  12. // Functions:
  13. //
  14. // History: 3/18/1996 RaviR Created
  15. //
  16. //____________________________________________________________________________
  17. #define LONG_DATE(st) MAKELONG(MAKEWORD(st.wDay, st.wMonth), st.wYear)
  18. #define LONG_TIME(st) MAKELONG(MAKEWORD(st.wSecond, st.wMinute), st.wHour)
  19. inline int CompareSystemDate(SYSTEMTIME &st1, SYSTEMTIME &st2)
  20. {
  21. long l1 = LONG_DATE(st1);
  22. long l2 = LONG_DATE(st2);
  23. if (l1 > l2) return 1;
  24. if (l1 < l2) return -1;
  25. return 0;
  26. }
  27. inline int CompareSystemTime(SYSTEMTIME &st1, SYSTEMTIME &st2)
  28. {
  29. long l1 = CompareSystemDate(st1, st2);
  30. long l2;
  31. if (l1 != 0)
  32. {
  33. return l1;
  34. }
  35. l1 = LONG_TIME(st1);
  36. l2 = LONG_TIME(st2);
  37. if (l1 > l2) return 1;
  38. if (l1 < l2) return -1;
  39. return 0;
  40. }