Leaked source code of windows server 2003
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.

272 lines
8.7 KiB

  1. /////////////////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 1998 Active Voice Corporation. All Rights Reserved.
  4. //
  5. // Active Agent(r) and Unified Communications(tm) are trademarks of Active Voice Corporation.
  6. //
  7. // Other brand and product names used herein are trademarks of their respective owners.
  8. //
  9. // The entire program and user interface including the structure, sequence, selection,
  10. // and arrangement of the dialog, the exclusively "yes" and "no" choices represented
  11. // by "1" and "2," and each dialog message are protected by copyrights registered in
  12. // the United States and by international treaties.
  13. //
  14. // Protected by one or more of the following United States patents: 5,070,526, 5,488,650,
  15. // 5,434,906, 5,581,604, 5,533,102, 5,568,540, 5,625,676, 5,651,054.
  16. //
  17. // Active Voice Corporation
  18. // Seattle, Washington
  19. // USA
  20. //
  21. /////////////////////////////////////////////////////////////////////////////////////////
  22. ////
  23. // date.h - interface for date functions in date.c
  24. ////
  25. #ifndef __DATE_H__
  26. #define __DATE_H__
  27. #include "winlocal.h"
  28. #define DATE_VERSION 0x00000108
  29. #define DATEWEEKDAY_MKTIME 0x00000001
  30. #define DATEWEEKDAY_QUICK 0x00000002
  31. #define DATEWEEKDAY_ZELLER 0x00000004
  32. #define DATEWEEKDAY_SAKAMOTO 0x00000008
  33. // date types
  34. //
  35. typedef long Date_t;
  36. typedef short Year_t;
  37. typedef short Month_t;
  38. typedef short Day_t;
  39. typedef short Weekday_t;
  40. #ifdef __cplusplus
  41. extern "C" {
  42. #endif
  43. // Date - return date value representing year <y>, month <m>, and day <d>
  44. // <y> (i) year
  45. // <m> (i) month
  46. // <d> (i) day
  47. // return date value (0 if error)
  48. // NOTE: if year is between 0 and 27, 2000 is added to it
  49. // NOTE: if year is between 28 and 127, 1900 is added to it
  50. //
  51. Date_t DLLEXPORT WINAPI Date(Year_t y, Month_t m, Day_t d);
  52. // DateToday - return date value representing current year, month, and day
  53. // return date value (0 if error)
  54. //
  55. Date_t DLLEXPORT WINAPI DateToday(void);
  56. // DateValue - return date value representing given date string
  57. // <lpszDate> (i) date string to convert
  58. // "JUL 25 1959"
  59. // "25 JUL 1959"
  60. // "7-25-1959"
  61. // etc.
  62. // return date value (0 if error)
  63. // NOTE: this function assumes English language month names only
  64. // NOTE: if no year specified, current year is assumed
  65. //
  66. Date_t DLLEXPORT WINAPI DateValue(LPCTSTR lpszDate);
  67. // DateYear - return year of a given date (1900-2027)
  68. // <d> (i) date value
  69. // return year
  70. //
  71. Year_t DLLEXPORT WINAPI DateYear(Date_t d);
  72. // DateMonth - return month of a given date (1-12)
  73. // <d> (i) date value
  74. // return month
  75. //
  76. Month_t DLLEXPORT WINAPI DateMonth(Date_t d);
  77. // DateDay - return day of the month for a given date (1-31)
  78. // <d> (i) date value
  79. // return day
  80. //
  81. Day_t DLLEXPORT WINAPI DateDay(Date_t d);
  82. // DateWeekDay - return day of the week for a given date
  83. // <date> (i) date value
  84. // <dwFlags> (i) control flags
  85. // 0 default algorithm
  86. // DATEWEEKDAY_MKTIME mktime algorithm (1/1/1970 - 1/18/2038)
  87. // DATEWEEKDAY_QUICK quick algorithm (3/2/1924 - 2/28/2100)
  88. // DATEWEEKDAY_ZELLER zeller congruence algorithm (1582 - )
  89. // DATEWEEKDAY_SAKAMOTO Tomohiko Sakamoto algorithm (1752 - )
  90. // return day of week (0 if error, 1 if SUN, 2 if MON, etc)
  91. //
  92. Weekday_t DLLEXPORT WINAPI DateWeekDay(Date_t date, DWORD dwFlags);
  93. // DateIsValid - test <date> for validity
  94. // <date> (i) date value
  95. // return TRUE if valid
  96. //
  97. BOOL DLLEXPORT WINAPI DateIsValid(Date_t date);
  98. // DateIsLeapYear - return TRUE if <y> represents a leap year
  99. // <y> (i) year value
  100. // return TRUE if leap year
  101. //
  102. BOOL DLLEXPORT WINAPI DateIsLeapYear(Year_t y);
  103. // DateNew - return date value which is <n> days from date <date>
  104. // <date> (i) date value
  105. // <n> (i) delta
  106. // +1 one day later
  107. // -1 one day earlier, etc.
  108. // return date value (0 if error)
  109. //
  110. Date_t DLLEXPORT WINAPI DateNew(Date_t date, short n);
  111. // DateCmp - return number of days between date1 and date2 (date1 minus date2)
  112. // <date1> (i) date value
  113. // <date2> (i) date value
  114. // return days between dates
  115. //
  116. long DLLEXPORT WINAPI DateCmp(Date_t date1, Date_t date2);
  117. // DateStartWeek - return date representing first day of the week relative to date <d>
  118. // <d> (i) date value
  119. // return date value (0 if error)
  120. //
  121. Date_t DLLEXPORT WINAPI DateStartWeek(Date_t d);
  122. // DateEndWeek - return date representing last day of the week relative to date <d>
  123. // <d> (i) date value
  124. // return date value (0 if error)
  125. //
  126. Date_t DLLEXPORT WINAPI DateEndWeek(Date_t d);
  127. // DateStartMonth - return date representing first day of the month relative to date <d>
  128. // <d> (i) date value
  129. // return date value (0 if error)
  130. //
  131. Date_t DLLEXPORT WINAPI DateStartMonth(Date_t d);
  132. // DateEndMonth - return date representing last day of the month relative to date <d>
  133. // <d> (i) date value
  134. // return date value (0 if error)
  135. //
  136. Date_t DLLEXPORT WINAPI DateEndMonth(Date_t d);
  137. // DateStartQuarter - return date representing first day of the quarter relative to date <d>
  138. // <d> (i) date value
  139. // return date value (0 if error)
  140. //
  141. Date_t DLLEXPORT WINAPI DateStartQuarter(Date_t d);
  142. // DateEndQuarter - return date representing last day of the quarter relative to date <d>
  143. // <d> (i) date value
  144. // return date value (0 if error)
  145. //
  146. Date_t DLLEXPORT WINAPI DateEndQuarter(Date_t d);
  147. // DateStartYear - return date representing first day of the year relative to date <d>
  148. // <d> (i) date value
  149. // return date value (0 if error)
  150. //
  151. Date_t DLLEXPORT WINAPI DateStartYear(Date_t d);
  152. // DateEndYear - return date representing last day of the year relative to date <d>
  153. // <d> (i) date value
  154. // return date value (0 if error)
  155. //
  156. Date_t DLLEXPORT WINAPI DateEndYear(Date_t d);
  157. // DateStartLastWeek - return date representing first day of previous week
  158. // return date value (0 if error)
  159. //
  160. Date_t DLLEXPORT WINAPI DateStartLastWeek(void);
  161. // DateEndLastWeek - return date representing last day of previous week
  162. // return date value (0 if error)
  163. //
  164. Date_t DLLEXPORT WINAPI DateEndLastWeek(void);
  165. // DateStartLastMonth - return date representing first day of previous month
  166. // return date value (0 if error)
  167. //
  168. Date_t DLLEXPORT WINAPI DateStartLastMonth(void);
  169. // DateEndLastMonth - return date representing last day of previous month
  170. // return date value (0 if error)
  171. //
  172. Date_t DLLEXPORT WINAPI DateEndLastMonth(void);
  173. // DateStartLastQuarter - return date representing first day of previous quarter
  174. // return date value (0 if error)
  175. //
  176. Date_t DLLEXPORT WINAPI DateStartLastQuarter(void);
  177. // DateEndLastQuarter - return date representing last day of previous quarter
  178. // return date value (0 if error)
  179. //
  180. Date_t DLLEXPORT WINAPI DateEndLastQuarter(void);
  181. // DateStartLastYear - return date representing first day of previous year
  182. // return date value (0 if error)
  183. //
  184. Date_t DLLEXPORT WINAPI DateStartLastYear(void);
  185. // DateEndLastYear - return date representing last day of previous year
  186. // return date value (0 if error)
  187. //
  188. Date_t DLLEXPORT WINAPI DateEndLastYear(void);
  189. // DateThisMonth - return date representing specified day of current month
  190. // <day> (i) day value
  191. // return date value (0 if error)
  192. //
  193. Date_t DLLEXPORT WINAPI DateThisMonth(Day_t day);
  194. // DateLastMonth - return date representing specified day of previous month
  195. // <day> (i) day value
  196. // return date value (0 if error)
  197. //
  198. Date_t DLLEXPORT WINAPI DateLastMonth(Day_t day);
  199. // macros to emulate MS Excel macros, etc.
  200. //
  201. #define DATE(y, m, d) Date(y, m, d)
  202. #define TODAY() DateToday()
  203. #define DATEVALUE(lpszDate) DateValue(lpszDate)
  204. #define YEAR(d) DateYear(d)
  205. #define MONTH(d) DateMonth(d)
  206. #define DAY(d) DateDay(d)
  207. #define WEEKDAY(d) DateWeekDay(d)
  208. #define ISVALIDDATE(date) DateIsValid(date)
  209. #define ISLEAPYEAR(y) DateIsLeapYear(y)
  210. #define NEWDATE(date, offset) DateNew(date, offset)
  211. #define DATECMP(d1, d2) DateCmp(d1, d2)
  212. #define STARTWEEK(d) DateStartWeek(d)
  213. #define ENDWEEK(d) DateEndWeek(d)
  214. #define STARTMONTH(d) DateStartMonth(d)
  215. #define ENDMONTH(d) DateEndMonth(d)
  216. #define STARTQUARTER(d) DateStartQuarter(d)
  217. #define ENDQUARTER(d) DateEndQuarter(d)
  218. #define STARTYEAR(d) DateStartYear(d)
  219. #define ENDYEAR(d) DateEndYear(d)
  220. #define STARTLASTWEEK() DateStartLastWeek()
  221. #define ENDLASTWEEK() DateEndLastWeek()
  222. #define STARTLASTMONTH() DateStartLastMonth()
  223. #define ENDLASTMONTH() DateEndLastMonth()
  224. #define STARTLASTQUARTER() DateStartLastQuarter()
  225. #define ENDLASTQUARTER() DateEndLastQuarter()
  226. #define STARTLASTYEAR() DateStartLastYear()
  227. #define ENDLASTYEAR() DateEndLastYear()
  228. #define THISMONTH(d) DateThisMonth(d)
  229. #define LASTMONTH(d) DateLastMonth(d)
  230. #ifdef __cplusplus
  231. }
  232. #endif
  233. #endif // __DATE_H__