Datetimes and times with negative representation don't display properly
adam-antonik opened this issue · comments
A very minor but annoying issue
> 1960-01-01T01:01:01.123456
1960-01-01T01:01:02.-876544
Solving this seems to just need something like the following added to showDateTime
inline std::string showDateTime(long x) {
int64_t s = x / (1000L * 1000L);
int64_t us = x % (1000L * 1000L);
if (us < 0) {
s -= 1;
us += 1000L * 1000L;
}
[...]
}
Similarly for showTime.
Oops, thank you! I can put in a PR later. :)
If you're going to threaten me like that, then whilst you're there:
> 01:01:02.123
01:01:02.000123
TTIME and TDATETIME both allow 3 digits after the dot, but still parse it as microseconds. 'u' needs to be multiplied by 1000 if s_u.second has length 3.
Good catch. >_<
I unintentionally pushed these changes to an existing PR, but I think they're small enough to go in anyway (the PR in question is also very minor):
These two fixes were merged to master.