aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/parse-xml.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/core/parse-xml.c b/core/parse-xml.c
index dd2250d21..2577d6380 100644
--- a/core/parse-xml.c
+++ b/core/parse-xml.c
@@ -322,16 +322,21 @@ static void temperature(char *buffer, temperature_t *temperature)
static void sampletime(char *buffer, duration_t *time)
{
int i;
- int min, sec;
+ int hr, min, sec;
- i = sscanf(buffer, "%d:%d", &min, &sec);
+ i = sscanf(buffer, "%d:%d:%d", &hr, &min, &sec);
switch (i) {
case 1:
- sec = min;
- min = 0;
+ min = hr;
+ hr = 0;
/* fallthrough */
case 2:
- time->seconds = sec + min * 60;
+ sec = min;
+ min = hr;
+ hr = 0;
+ /* fallthrough */
+ case 3:
+ time->seconds = (hr * 60 + min) * 60 + sec;
break;
default:
printf("Strange sample time reading %s\n", buffer);