Created
November 14, 2017 16:55
-
-
Save EvanCarroll/4b5d997fd6585bd30a168c3a11f841c2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
export PGROOT=/home/ecarroll/code/postgres/ | |
gcc \ | |
-I "$PGROOT/src/include/" \ | |
-I "$PGROOT/src/interfaces/ecpg" \ | |
-I "$PGROOT/src/interfaces/ecpg/include" \ | |
./test.c \ | |
-o a.out |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In file included from ./test.c:2:0: | |
/home/ecarroll/code/postgres//src/interfaces/ecpg/pgtypeslib/dt.h:314:57: warning: ‘struct tm’ declared inside parameter list will not be visible outside of this definition or declaration | |
int DecodeInterval(char **, int *, int, int *, struct tm *, fsec_t *); | |
^~ | |
/home/ecarroll/code/postgres//src/interfaces/ecpg/pgtypeslib/dt.h:315:40: warning: ‘struct tm’ declared inside parameter list will not be visible outside of this definition or declaration | |
int DecodeTime(char *, int *, struct tm *, fsec_t *); | |
^~ | |
/home/ecarroll/code/postgres//src/interfaces/ecpg/pgtypeslib/dt.h:316:29: warning: ‘struct tm’ declared inside parameter list will not be visible outside of this definition or declaration | |
int EncodeDateTime(struct tm *tm, fsec_t fsec, bool print_tz, int tz, const char *tzn, int style, char *str, bool EuroDates); | |
^~ | |
In file included from ./test.c:2:0: | |
/home/ecarroll/code/postgres//src/interfaces/ecpg/pgtypeslib/dt.h:317:29: warning: ‘struct tm’ declared inside parameter list will not be visible outside of this definition or declaration | |
int EncodeInterval(struct tm *tm, fsec_t fsec, int style, char *str); | |
^~ | |
/home/ecarroll/code/postgres//src/interfaces/ecpg/pgtypeslib/dt.h:318:27: warning: ‘struct tm’ declared inside parameter list will not be visible outside of this definition or declaration | |
int tm2timestamp(struct tm *, fsec_t, int *, timestamp *); | |
^~ | |
/home/ecarroll/code/postgres//src/interfaces/ecpg/pgtypeslib/dt.h:321:29: warning: ‘struct tm’ declared inside parameter list will not be visible outside of this definition or declaration | |
int EncodeDateOnly(struct tm *tm, int style, char *str, bool EuroDates); | |
^~ | |
/home/ecarroll/code/postgres//src/interfaces/ecpg/pgtypeslib/dt.h:322:27: warning: ‘struct tm’ declared inside parameter list will not be visible outside of this definition or declaration | |
int GetEpochTime(struct tm *); | |
^~ | |
/home/ecarroll/code/postgres//src/interfaces/ecpg/pgtypeslib/dt.h:324:57: warning: ‘struct tm’ declared inside parameter list will not be visible outside of this definition or declaration | |
int DecodeDateTime(char **, int *, int, int *, struct tm *, fsec_t *, bool); | |
^~ | |
/home/ecarroll/code/postgres//src/interfaces/ecpg/pgtypeslib/dt.h:326:33: warning: ‘struct tm’ declared inside parameter list will not be visible outside of this definition or declaration | |
void GetCurrentDateTime(struct tm *); | |
^~ | |
In file included from ./test.c:6:0: | |
/home/ecarroll/code/postgres//src/interfaces/ecpg/pgtypeslib/timestamp.c:42:1: error: conflicting types for ‘tm2timestamp’ | |
tm2timestamp(struct tm *tm, fsec_t fsec, int *tzp, timestamp * result) | |
^~~~~~~~~~~~ | |
In file included from ./test.c:2:0: | |
/home/ecarroll/code/postgres//src/interfaces/ecpg/pgtypeslib/dt.h:318:7: note: previous declaration of ‘tm2timestamp’ was here | |
int tm2timestamp(struct tm *, fsec_t, int *, timestamp *); | |
^~~~~~~~~~~~ | |
In file included from ./test.c:6:0: | |
/home/ecarroll/code/postgres//src/interfaces/ecpg/pgtypeslib/timestamp.c: In function ‘SetEpochTimestamp’: | |
/home/ecarroll/code/postgres//src/interfaces/ecpg/pgtypeslib/timestamp.c:80:19: warning: passing argument 1 of ‘GetEpochTime’ from incompatible pointer type [-Wincompatible-pointer-types] | |
if (GetEpochTime(tm) < 0) | |
^~ | |
In file included from ./test.c:2:0: | |
/home/ecarroll/code/postgres//src/interfaces/ecpg/pgtypeslib/dt.h:322:7: note: expected ‘struct tm *’ but argument is of type ‘struct tm *’ | |
int GetEpochTime(struct tm *); | |
^~~~~~~~~~~~ | |
In file included from ./test.c:6:0: | |
/home/ecarroll/code/postgres//src/interfaces/ecpg/pgtypeslib/timestamp.c: In function ‘PGTYPEStimestamp_from_asc’: | |
/home/ecarroll/code/postgres//src/interfaces/ecpg/pgtypeslib/timestamp.c:231:44: warning: passing argument 5 of ‘DecodeDateTime’ from incompatible pointer type [-Wincompatible-pointer-types] | |
DecodeDateTime(field, ftype, nf, &dtype, tm, &fsec, 0) != 0) | |
^~ | |
In file included from ./test.c:2:0: | |
/home/ecarroll/code/postgres//src/interfaces/ecpg/pgtypeslib/dt.h:324:7: note: expected ‘struct tm *’ but argument is of type ‘struct tm *’ | |
int DecodeDateTime(char **, int *, int, int *, struct tm *, fsec_t *, bool); | |
^~~~~~~~~~~~~~ | |
In file included from ./test.c:6:0: | |
/home/ecarroll/code/postgres//src/interfaces/ecpg/pgtypeslib/timestamp.c: In function ‘PGTYPEStimestamp_to_asc’: | |
/home/ecarroll/code/postgres//src/interfaces/ecpg/pgtypeslib/timestamp.c:291:18: warning: passing argument 1 of ‘EncodeDateTime’ from incompatible pointer type [-Wincompatible-pointer-types] | |
EncodeDateTime(tm, fsec, false, 0, NULL, DateStyle, buf, 0); | |
^~ | |
In file included from ./test.c:2:0: | |
/home/ecarroll/code/postgres//src/interfaces/ecpg/pgtypeslib/dt.h:316:7: note: expected ‘struct tm *’ but argument is of type ‘struct tm *’ | |
int EncodeDateTime(struct tm *tm, fsec_t fsec, bool print_tz, int tz, const char *tzn, int style, char *str, bool EuroDates); | |
^~~~~~~~~~~~~~ | |
In file included from ./test.c:6:0: | |
/home/ecarroll/code/postgres//src/interfaces/ecpg/pgtypeslib/timestamp.c: In function ‘PGTYPEStimestamp_current’: | |
/home/ecarroll/code/postgres//src/interfaces/ecpg/pgtypeslib/timestamp.c:305:21: warning: passing argument 1 of ‘GetCurrentDateTime’ from incompatible pointer type [-Wincompatible-pointer-types] | |
GetCurrentDateTime(&tm); | |
^ | |
In file included from ./test.c:2:0: | |
/home/ecarroll/code/postgres//src/interfaces/ecpg/pgtypeslib/dt.h:326:7: note: expected ‘struct tm *’ but argument is of type ‘struct tm *’ | |
void GetCurrentDateTime(struct tm *); | |
^~~~~~~~~~~~~~~~~~ | |
./test.c: In function ‘main’: | |
./test.c:16:16: warning: passing argument 1 of ‘timestamp2tm’ makes integer from pointer without a cast [-Wint-conversion] | |
timestamp2tm( &t1, NULL, tm, &fsec, NULL ); | |
^ | |
In file included from ./test.c:6:0: | |
/home/ecarroll/code/postgres//src/interfaces/ecpg/pgtypeslib/timestamp.c:99:1: note: expected ‘timestamp {aka long int}’ but argument is of type ‘timestamp * {aka long int *}’ | |
timestamp2tm(timestamp dt, int *tzp, struct tm *tm, fsec_t *fsec, const char **tzn) | |
^~~~~~~~~~~~ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "postgres_fe.h" | |
#include "pgtypeslib/dt.h" | |
#include "pgtypeslib/extern.h" | |
#include "pgtypes_timestamp.h" | |
#include "pgtypeslib/timestamp.c" | |
#include <time.h> | |
int main () { | |
timestamp t1 = 315671400000000l; | |
struct tm tt, *tm = &tt; | |
fsec_t fsec; | |
timestamp2tm( &t1, NULL, tm, &fsec, NULL ); | |
//printf( "%d", tm->tm_year ); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment