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