summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2014-08-03 13:02:32 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-08-03 13:02:32 -0700
commit2ad433671f723db36dec268b74c69994a7bdd427 (patch)
treeaa1ceb3788a9e81033cd535e2ca06c7497995c12
parentfc75457cc8b3e37ecbd2a2f2111660586a6132da (diff)
downloadsubsurface-2ad433671f723db36dec268b74c69994a7bdd427.tar.gz
Use Qt date localization instead of translated strings
This gets us consistent date format everywhere. The reordering of month name and day of the month didn't work correctly on Windows, anyway. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--dive.h1
-rw-r--r--libdivecomputer.c3
-rw-r--r--qt-gui.cpp6
3 files changed, 8 insertions, 2 deletions
diff --git a/dive.h b/dive.h
index 0bffeb69e..a03dfe141 100644
--- a/dive.h
+++ b/dive.h
@@ -760,6 +760,7 @@ extern double strtod_flags(const char *str, const char **ptr, unsigned int flags
extern void set_save_userid_local(short value);
extern void set_userid(char *user_id);
+extern const char *get_dive_date_c_string(timestamp_t when);
#ifdef __cplusplus
}
#endif
diff --git a/libdivecomputer.c b/libdivecomputer.c
index 22df874fe..b599b3d14 100644
--- a/libdivecomputer.c
+++ b/libdivecomputer.c
@@ -435,8 +435,7 @@ static int dive_cb(const unsigned char *data, unsigned int size,
dive->when = dive->dc.when = utc_mktime(&tm);
// Parse the divetime.
- dev_info(devdata, translate("gettextFromC", "Dive %d: %s %d %04d"), import_dive_number,
- monthname(tm.tm_mon), tm.tm_mday, year(tm.tm_year));
+ dev_info(devdata, translate("gettextFromC", "Dive %d: %s"), import_dive_number, get_dive_date_c_string(dive->when));
unsigned int divetime = 0;
rc = dc_parser_get_field(parser, DC_FIELD_DIVETIME, 0, &divetime);
if (rc != DC_STATUS_SUCCESS && rc != DC_STATUS_UNSUPPORTED) {
diff --git a/qt-gui.cpp b/qt-gui.cpp
index e337a5ddd..6abdd83ae 100644
--- a/qt-gui.cpp
+++ b/qt-gui.cpp
@@ -419,6 +419,12 @@ QString get_short_dive_date_string(timestamp_t when)
return loc.toString(ts.toUTC(), shortDateFormat + " " + timeFormat);
}
+const char *get_dive_date_c_string(timestamp_t when)
+{
+ QString text = get_dive_date_string(when);
+ return strdup(text.toUtf8().data());
+}
+
QString get_trip_date_string(timestamp_t when, int nr)
{
struct tm tm;