]> granicus.if.org Git - postgresql/blob - src/interfaces/ecpg/include/pgtypes_interval.h
3e5e6dc1639941eda5e5e50ae66ba47e97917543
[postgresql] / src / interfaces / ecpg / include / pgtypes_interval.h
1 /* $PostgreSQL: pgsql/src/interfaces/ecpg/include/pgtypes_interval.h,v 1.14 2007/05/28 09:46:47 meskes Exp $ */
2
3 #ifndef PGTYPES_INTERVAL
4 #define PGTYPES_INTERVAL
5
6 #include <ecpg_config.h>
7
8 #ifndef C_H
9
10 #ifdef HAVE_LONG_INT_64
11 #ifndef HAVE_INT64
12 typedef long int int64;
13 #endif
14 #elif defined(HAVE_LONG_LONG_INT_64)
15 /* We have working support for "long long int", use that */
16
17 #ifndef HAVE_INT64
18 typedef long long int int64;
19 #endif
20 #else                                                   /* not HAVE_LONG_INT_64 and not
21                                                                  * HAVE_LONG_LONG_INT_64 */
22
23 /* Won't actually work, but fall back to long int so that code compiles */
24 #ifndef HAVE_INT64
25 typedef long int int64;
26 #endif
27
28 #define INT64_IS_BUSTED
29 #endif   /* not HAVE_LONG_INT_64 and not
30                                                                  * HAVE_LONG_LONG_INT_64 */
31 #endif   /* C_H */
32
33 #if defined(USE_INTEGER_DATETIMES) && !defined(INT64_IS_BUSTED)
34 #define HAVE_INT64_TIMESTAMP
35 #endif
36
37 typedef struct
38 {
39 #ifdef HAVE_INT64_TIMESTAMP
40         int64           time;                   /* all time units other than months and years */
41 #else
42         double          time;                   /* all time units other than months and years */
43 #endif
44         long            month;                  /* months and years, after time for alignment */
45 }       interval;
46
47 #ifdef __cplusplus
48 extern          "C"
49 {
50 #endif
51
52 extern interval *PGTYPESinterval_new(void);
53 extern void PGTYPESinterval_free(interval *);
54 extern interval *PGTYPESinterval_from_asc(char *, char **);
55 extern char *PGTYPESinterval_to_asc(interval *);
56 extern int      PGTYPESinterval_copy(interval *, interval *);
57
58 #ifdef __cplusplus
59 }
60 #endif
61
62 #endif   /* PGTYPES_INTERVAL */