diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-03 16:04:07 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-03 16:04:07 -0700 |
commit | fb504b50d0f2b881d2be6dcc657f74cca663d217 (patch) | |
tree | a3a18fa430afbe70db82c533c4605b82b38d37e0 /libdivecomputer.c | |
parent | e7a70b6ae821e6a178957e2814406ac387b990ea (diff) | |
download | subsurface-fb504b50d0f2b881d2be6dcc657f74cca663d217.tar.gz |
divecomputer importing: show the date of the currently importing dive
I'm hoping most other dive computers are quicker to import from than the
Suunto I have, but mine can take minutes to import all the dives. Sure,
we have that nice progress bar, so it shows that it's doing something,
but it's not really showing *what* it is doing.
So instead of showing just "Parsing dive X", let's show the date of the
dive. That way, when it takes two minutes to import all the dives, at
least you can see "oh, it's going back to the dives of last year" and it
then feels like you have some good reason for the delay.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'libdivecomputer.c')
-rw-r--r-- | libdivecomputer.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/libdivecomputer.c b/libdivecomputer.c index bd31eb04e..e59dd6aff 100644 --- a/libdivecomputer.c +++ b/libdivecomputer.c @@ -261,6 +261,15 @@ static int find_dive(struct dive *dive, device_data_t *devdata) return 0; } +static inline int year(int year) +{ + if (year < 70) + return year + 2000; + if (year < 100) + return year + 1900; + return year; +} + static int dive_cb(const unsigned char *data, unsigned int size, const unsigned char *fingerprint, unsigned int fsize, void *userdata) @@ -303,7 +312,8 @@ static int dive_cb(const unsigned char *data, unsigned int size, dive->when = utc_mktime(&tm); // Parse the divetime. - dev_info(devdata, "Parsing dive %d", import_dive_number); + dev_info(devdata, "Dive %d: %s %d %04d", import_dive_number, + monthname(tm.tm_mon), tm.tm_mday, year(tm.tm_year)); unsigned int divetime = 0; rc = parser_get_field (parser, FIELD_TYPE_DIVETIME, 0, &divetime); if (rc != PARSER_STATUS_SUCCESS && rc != PARSER_STATUS_UNSUPPORTED) { |