xdrdatetime.c 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*!
  2. \file lib/db/dbmi_base/xdrdatetime.c
  3. \brief DBMI Library (base) - external data representation (datatime)
  4. (C) 1999-2009, 2011 by the GRASS Development Team
  5. This program is free software under the GNU General Public License
  6. (>=v2). Read the file COPYING that comes with GRASS for details.
  7. \author Joel Jones (CERL/UIUC), Radim Blazek, Brad Douglas, Markus Neteler
  8. \author Doxygenized by Martin Landa <landa.martin gmail.com> (2011)
  9. */
  10. #include <grass/dbmi.h>
  11. #include "macros.h"
  12. /*!
  13. \brief Send datetime
  14. \param t pointer to dbDateTime
  15. \return DB_OK
  16. */
  17. int db__send_datetime(dbDateTime * t)
  18. {
  19. DB_SEND_CHAR(t->current);
  20. if (!t->current) {
  21. DB_SEND_INT(t->year);
  22. DB_SEND_INT(t->month);
  23. DB_SEND_INT(t->day);
  24. DB_SEND_INT(t->hour);
  25. DB_SEND_INT(t->minute);
  26. DB_SEND_DOUBLE(t->seconds);
  27. }
  28. return DB_OK;
  29. }
  30. /*!
  31. \brief Receive datetime
  32. \param t pointer to dbDateTime
  33. \return DB_OK
  34. */
  35. int db__recv_datetime(dbDateTime * t)
  36. {
  37. DB_RECV_CHAR(&t->current);
  38. if (!t->current) {
  39. DB_RECV_INT(&t->year);
  40. DB_RECV_INT(&t->month);
  41. DB_RECV_INT(&t->day);
  42. DB_RECV_INT(&t->hour);
  43. DB_RECV_INT(&t->minute);
  44. DB_RECV_DOUBLE(&t->seconds);
  45. }
  46. return DB_OK;
  47. }