summaryrefslogtreecommitdiffstats
path: root/file.c
diff options
context:
space:
mode:
authorGravatar Miika Turkia <miika.turkia@gmail.com>2014-11-25 19:47:04 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-11-25 13:19:49 -0800
commit1b74947bf56a2ef3b38470044d991a75ed0c5e30 (patch)
treea4b63ce2d76ee024870d5b1dc8d6039f7b391702 /file.c
parent3b3d8949f7b3aede87fd779b314c6604020cbd16 (diff)
downloadsubsurface-1b74947bf56a2ef3b38470044d991a75ed0c5e30.tar.gz
Allow user to select date format on manual CSV import
Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'file.c')
-rw-r--r--file.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/file.c b/file.c
index f6b415e76..e755b3ad4 100644
--- a/file.c
+++ b/file.c
@@ -943,11 +943,11 @@ int parse_seabear_csv_file(const char *filename, int timef, int depthf, int temp
return 0;
}
-int parse_manual_file(const char *filename, int sepidx, int units, int numberf, int datef, int timef, int durationf, int locationf, int gpsf, int maxdepthf, int meandepthf, int buddyf, int notesf, int weightf, int tagsf)
+int parse_manual_file(const char *filename, int sepidx, int units, int dateformat, int numberf, int datef, int timef, int durationf, int locationf, int gpsf, int maxdepthf, int meandepthf, int buddyf, int notesf, int weightf, int tagsf)
{
struct memblock mem;
int pnr = 0;
- char *params[33];
+ char *params[35];
char numberbuf[MAXCOLDIGITS];
char datebuf[MAXCOLDIGITS];
char timebuf[MAXCOLDIGITS];
@@ -962,6 +962,7 @@ int parse_manual_file(const char *filename, int sepidx, int units, int numberf,
char tagsbuf[MAXCOLDIGITS];
char separator_index[MAXCOLDIGITS];
char unit[MAXCOLDIGITS];
+ char datefmt[MAXCOLDIGITS];
time_t now;
struct tm *timep;
char curdate[9];
@@ -984,6 +985,7 @@ int parse_manual_file(const char *filename, int sepidx, int units, int numberf,
snprintf(tagsbuf, MAXCOLDIGITS, "%d", tagsf);
snprintf(separator_index, MAXCOLDIGITS, "%d", sepidx);
snprintf(unit, MAXCOLDIGITS, "%d", units);
+ snprintf(datefmt, MAXCOLDIGITS, "%d", dateformat);
time(&now);
timep = localtime(&now);
strftime(curdate, DATESTR, "%Y%m%d", timep);
@@ -1024,6 +1026,8 @@ int parse_manual_file(const char *filename, int sepidx, int units, int numberf,
params[pnr++] = separator_index;
params[pnr++] = "units";
params[pnr++] = unit;
+ params[pnr++] = "datefmt";
+ params[pnr++] = datefmt;
params[pnr++] = NULL;
if (filename == NULL)