summaryrefslogtreecommitdiffstats
path: root/parse-xml.c
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2011-09-04 12:09:48 -0700
committerGravatar Linus Torvalds <torvalds@linux-foundation.org>2011-09-04 12:19:20 -0700
commitaab4d593bdbffef8442282318778a9833cbc7a43 (patch)
tree42d1deea38a5c9155c9138a0af85d14d04198e8a /parse-xml.c
parent230a13476d9af732cb60b2c0393feeadb5b39e67 (diff)
downloadsubsurface-aab4d593bdbffef8442282318778a9833cbc7a43.tar.gz
Generate date string for the dive list dynamically
.. and sort based on the 'time_t' value itself. This allows us to use a more compact date format that doesn't need to sort alphabetically, because sorting by date is always based on the date value. So we can use just a two-digit year, and skip the seconds, to keep the column narrow, while still sorting correctly. Also, "Depth" is a nice header string, but it is wider than the column itself, which makes the whole column wider than necessary. So put the units in the header instead of in the string, keeping things narrow. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'parse-xml.c')
-rw-r--r--parse-xml.c22
1 files changed, 0 insertions, 22 deletions
diff --git a/parse-xml.c b/parse-xml.c
index a2c685ed5..3221111c7 100644
--- a/parse-xml.c
+++ b/parse-xml.c
@@ -683,26 +683,6 @@ static void dive_start(void)
memset(&tm, 0, sizeof(tm));
}
-static char *generate_name(struct dive *dive)
-{
- int len;
- struct tm *tm;
- char buffer[256], *p;
-
- tm = gmtime(&dive->when);
-
- len = snprintf(buffer, sizeof(buffer),
- "%04d-%02d-%02d "
- "%02d:%02d:%02d",
- tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday,
- tm->tm_hour, tm->tm_min, tm->tm_sec);
- p = malloc(len+1);
- if (!p)
- exit(1);
- memcpy(p, buffer, len+1);
- return p;
-}
-
static void sanitize_gasmix(gasmix_t *mix)
{
unsigned int o2, he;
@@ -770,8 +750,6 @@ static void dive_end(void)
{
if (!dive)
return;
- if (!dive->name)
- dive->name = generate_name(dive);
sanitize_cylinder_info(dive);
record_dive(dive);
dive = NULL;