mysql_time.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /* Copyright (C) 2004 MySQL AB
  2. This program is free software; you can redistribute it and/or modify
  3. it under the terms of the GNU General Public License as published by
  4. the Free Software Foundation; version 2 of the License.
  5. This program is distributed in the hope that it will be useful,
  6. but WITHOUT ANY WARRANTY; without even the implied warranty of
  7. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  8. GNU General Public License for more details.
  9. You should have received a copy of the GNU General Public License
  10. along with this program; if not, write to the Free Software
  11. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
  12. #ifndef _mysql_time_h_
  13. #define _mysql_time_h_
  14. /*
  15. Time declarations shared between the server and client API:
  16. you should not add anything to this header unless it's used
  17. (and hence should be visible) in mysql.h.
  18. If you're looking for a place to add new time-related declaration,
  19. it's most likely my_time.h. See also "C API Handling of Date
  20. and Time Values" chapter in documentation.
  21. */
  22. enum enum_mysql_timestamp_type
  23. {
  24. MYSQL_TIMESTAMP_NONE= -2, MYSQL_TIMESTAMP_ERROR= -1,
  25. MYSQL_TIMESTAMP_DATE= 0, MYSQL_TIMESTAMP_DATETIME= 1, MYSQL_TIMESTAMP_TIME= 2
  26. };
  27. /*
  28. Structure which is used to represent datetime values inside MySQL.
  29. We assume that values in this structure are normalized, i.e. year <= 9999,
  30. month <= 12, day <= 31, hour <= 23, hour <= 59, hour <= 59. Many functions
  31. in server such as my_system_gmt_sec() or make_time() family of functions
  32. rely on this (actually now usage of make_*() family relies on a bit weaker
  33. restriction). Also functions that produce MYSQL_TIME as result ensure this.
  34. There is one exception to this rule though if this structure holds time
  35. value (time_type == MYSQL_TIMESTAMP_TIME) days and hour member can hold
  36. bigger values.
  37. */
  38. typedef struct st_mysql_time
  39. {
  40. unsigned int year, month, day, hour, minute, second;
  41. unsigned long second_part;
  42. my_bool neg;
  43. enum enum_mysql_timestamp_type time_type;
  44. } MYSQL_TIME;
  45. #endif /* _mysql_time_h_ */