datetime: fix negative years formatting
Negative Julian dates used to be incorrectly formatted, if there were non-zero hour/minutes/second. ``` tarantool> T = date.new{year = -1, month = 6, day = 10, hour = 12, min = 10, sec = 10} tarantool> T - -001-06-11T-11:-49:-50Z ``` The problem is due to operator % in C/C++ which is returning negative modulo toward 0. Use Euclidian (floored) modulo instead. Correct both `tostring(T)`/`T:format()` and `strftime`-like 'T:format(fmt)' ``` tarantool> T:format() - -001-06-10T12:10:10Z tarantool> T:format('%FT%T.%f%z') - -001-06-10T12:10:10.000+0000 ``` Follow-up to #5941
Loading
Please register or sign in to comment