GRASS GIS 8 Programmer's Manual  8.2.2dev(2023)-3d2c704037
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 {
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);
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);
57  }
58 
59  return DB_OK;
60 }
int db__recv_datetime(dbDateTime *t)
Receive datetime.
Definition: xdrdatetime.c:47
#define DB_SEND_CHAR(x)
Definition: macros.h:23
int minute
Definition: dbmi.h:189
#define DB_SEND_INT(x)
Definition: macros.h:37
#define DB_RECV_INT(x)
Definition: macros.h:39
int hour
Definition: dbmi.h:188
#define DB_RECV_DOUBLE(x)
Definition: macros.h:49
int db__send_datetime(dbDateTime *t)
Send datetime.
Definition: xdrdatetime.c:25
double t
Definition: r_raster.c:39
#define DB_SEND_DOUBLE(x)
Definition: macros.h:47
#define DB_RECV_CHAR(x)
Definition: macros.h:25
double seconds
Definition: dbmi.h:190
char current
Definition: dbmi.h:184
int month
Definition: dbmi.h:186
int year
Definition: dbmi.h:185
int day
Definition: dbmi.h:187
#define DB_OK
Definition: dbmi.h:71