summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6eee9bc)
raw | patch | inline | side by side (parent: 6eee9bc)
author | Sebastian Harl <sh@tokkee.org> | |
Sun, 23 Nov 2014 18:01:17 +0000 (19:01 +0100) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Sun, 23 Nov 2014 18:01:17 +0000 (19:01 +0100) |
It turns out, mktime() cannot be used to parse a time (at day 0). Let's do it
manually then, it's no big magic anyway ;-)
manually then, it's no big magic anyway ;-)
src/frontend/scanner.l | patch | blob | history |
diff --git a/src/frontend/scanner.l b/src/frontend/scanner.l
index f17b689c97a5b98f03a47ac341981ac07e832f66..65ec9edceb79ff73769e03e37046123971d9b73f 100644 (file)
--- a/src/frontend/scanner.l
+++ b/src/frontend/scanner.l
struct tm tm;
char time[9], ns[10];
char *tmp;
+ int t;
memset(&tm, 0, sizeof(tm));
memset(time, '\0', sizeof(time));
return SCANNER_ERROR;
}
- yylval->datetime = SECS_TO_SDB_TIME(mktime(&tm));
+ t = tm.tm_sec + 60 * tm.tm_min + 3600 * tm.tm_hour;
+ yylval->datetime = SECS_TO_SDB_TIME(t);
yylval->datetime += (sdb_time_t)strtoll(ns, NULL, 10);
return TIME;
}