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.

45 lines
1.7 KiB

  1. // nmtime.h - defines DOS packed date and time types
  2. //
  3. // Copyright (c) 1987-1990, Microsoft Corporation. All rights reserved.
  4. //
  5. // Purpose:
  6. // This file defines the DOS packed date and time types.
  7. //
  8. // Revision History:
  9. // 19-May-1993 HV Changed _dtoxtime() to _dostotime_t() so that we can
  10. // use the standard llibce.lib instead of the private
  11. // llibcer.lib.
  12. // 04-Dec-1989 SB added proper fn proto for _dtoxtime() (c6 -W3 reqmemt)
  13. // 05-Dec-1988 SB added CDECL for _dtoxtime()
  14. // ??-???-???? ?? Taken from dostypes.h
  15. #define MASK4 0xf // 4 bit mask
  16. #define MASK5 0x1f // 5 bit mask
  17. #define MASK6 0x3f // 6 bit mask
  18. #define MASK7 0x7f // 7 bit mask
  19. #define DAYLOC 0 // day value starts in bit 0
  20. #define MONTHLOC 5 // month value starts in bit 5
  21. #define YEARLOC 9 // year value starts in bit 9
  22. #define SECLOC 0 // seconds value starts in bit 0
  23. #define MINLOC 5 // minutes value starts in bit 5
  24. #define HOURLOC 11 // hours value starts in bit 11
  25. #define DOS_DAY(dword) (((dword) >> DAYLOC) & MASK5)
  26. #define DOS_MONTH(dword) (((dword) >> MONTHLOC) & MASK4)
  27. #define DOS_YEAR(dword) (((dword) >> YEARLOC) & MASK7)
  28. #define DOS_HOUR(tword) (((tword) >> HOURLOC) & MASK5)
  29. #define DOS_MIN(tword) (((tword) >> MINLOC) & MASK6)
  30. #define DOS_SEC(tword) (((tword) >> SECLOC) & MASK5)
  31. extern time_t CDECL _dostotime_t(int, int, int, int, int, int);
  32. #define XTIME(d,t) _dostotime_t(DOS_YEAR(d), \
  33. DOS_MONTH(d), \
  34. DOS_DAY(d), \
  35. DOS_HOUR(t), \
  36. DOS_MIN(t), \
  37. DOS_SEC(t)*2)