summaryrefslogtreecommitdiffstats
path: root/divelist.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-05-31 17:59:01 +1000
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-05-31 17:59:01 +1000
commit9a65798daf3dc0e7991305ce759d42d40d2dc98c (patch)
tree07bd8a275f3e02832e8277bcba9849f1330d965e /divelist.c
parent5c2a2691fdccb9d355fe7f71c19aa104b9d570f4 (diff)
downloadsubsurface-9a65798daf3dc0e7991305ce759d42d40d2dc98c.tar.gz
Use a slightly shorter date string for Info tab
This way the spacing of the elements looks nicer. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'divelist.c')
-rw-r--r--divelist.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/divelist.c b/divelist.c
index 68e9cf4e6..7abad667b 100644
--- a/divelist.c
+++ b/divelist.c
@@ -566,7 +566,8 @@ void get_suit(struct dive *dive, char **str)
#define MAX_DATE_STRING 256
/* caller needs to free the string */
-char *get_dive_date_string(timestamp_t when) {
+char *get_dive_date_string(timestamp_t when)
+{
char *buffer = malloc(MAX_DATE_STRING);
if (buffer) {
struct tm tm;
@@ -582,8 +583,25 @@ char *get_dive_date_string(timestamp_t when) {
return buffer;
}
+char *get_short_dive_date_string(timestamp_t when)
+{
+ char *buffer = malloc(MAX_DATE_STRING);
+ if (buffer) {
+ struct tm tm;
+ utc_mkdate(when, &tm);
+ snprintf(buffer, MAX_DATE_STRING,
+ /*++GETTEXT 40 char buffer monthname, day of month, year, hour:min */
+ _("%1$s %2$d, %3$d\n%4$02d:%5$02d"),
+ monthname(tm.tm_mon),
+ tm.tm_mday, tm.tm_year +1900,
+ tm.tm_hour, tm.tm_min);
+ }
+ return buffer;
+}
+
/* caller needs to free the string */
-char *get_trip_date_string(timestamp_t when, int nr) {
+char *get_trip_date_string(timestamp_t when, int nr)
+{
char *buffer = malloc(MAX_DATE_STRING);
if (buffer) {
struct tm tm;