Open zesp585 opened 5 years ago
Hi M, yes you're correct and no, not missing anything. The sad truth is that time differences with nanosecond resolution aren't supported (yet).
At the moment only two (internal) date types are capable in principle to support nanosecond (and they're not very prominent): matlab day number (mdn) and lilian day number (ldn). The other types, especially the ones exposed to the cli tools, don't have the capacity to carry nanoseconds and support the full range from the year 1601 to the year 4095.
Let's talk again when 128-bit computers are a thing? :)
Thanks Sebastian.
Actually ms or us would be enough. Any hope?
I mentioned ns because of the GNU date command '%N' format argument.
Here's the trick I use for the time being:
t0=$(dateutils.dconv -i '%0y/%0m/%0d %0H:%0M:%0S.%N' -f '%s.%N' '19/01/01 00:00:00.000')
dateutils.dconv -i '%0y/%0m/%0d %0H:%0M:%0S.%N' -f "%s.%N - $t0" '19/01/01 00:00:01.100' | bc
Cheers, M
Hi M, because you asked so nicely :+1: I went and implemented nanosecond diffs, see 9b5cd144f (master). For the time being this only works on times (as in not datetimes) for capacity reasons.
Prima ! Danke Sebastian.
So here's an intermediate trick:
d0='19/01/01' ; t0='12:00:00.000'
d1='19/01/02' ; t1='12:00:05.005'
echo "$(./ddiff -i "%0y/%0m/%0d" "$d0" "$d1" -f '%0S') + $(./ddiff -i "%0H:%0M:%0S.%N" "$t0" "$t1" -f '%0S.%N')" | bc
Looking forward to the full datetime release ;-)
Tschüss, M
Hi M, because you asked so nicely 👍 I went and implemented nanosecond diffs, see 9b5cd14 (master). For the time being this only works on times (as in not datetimes) for capacity reasons.
Where is documented how it works?
I try this but not work as expected:
/usr/local/bin/datediff "2020-05-08T14:59:30.000Z" "2020-05-08T15:00:36.440Z" -f %S%N
the result is 66000000000
version: datediff 0.4.7.git7.9cee261
How is the correct format?
thanks.
Hi there,
und vielen Dank für dieses sehr handy Tool.
I do not manage to use ddiff with nanoseconds
> dateutils.ddiff -i "%0H:%0M:%0S.%N" '12:00:00.000000000' '12:01:01.1000000000' -f '%0S.%N'
> 61.
Do I miss something?Cheers, M