Thank you for all these replays! What I do not understand: - Why all these argues / discussions ???
1. If Pascal / FPC can only handle 3 digits, it's OK !
Than let's limit the value while converting by default!
2. That's what I did. Provided a finished, working, 3-line fix.
Copy + Paste -> next release, all OK. DONE.3. The only thing I was wrong:[/size]
- YES, there could be
MORE than 4 chars,
- so why not allowing max of a WORD (integer), like 8 or 9 ?
- I've seen Linux (Debian) LOGs showing 6+ fractions of a second.
- This code should not only work with Firebird, but ALL kinds of (future?) Database code. We can not predict, which one is using 4,6 or more.
Firebird's default = 4 digits. It's not a "bug", it's a FACT.
The bug is, that FPC can not convert it to it's own format.
________________________________________________
Down from here are only my opinions:4. ... wikipedia is quite clear -
A decimal fraction may be added to the lowest order time element present in any of these representations. A decimal mark, either a comma or a dot on the baseline, is used as a separator between the time element and its fraction. (Following ISO 80000-1 according to ISO 8601:1-2019,[27] it does not stipulate a preference except within International Standards, but with a preference for a comma according to ISO 8601:2004.[28]) For example, to denote "14 hours, 30 and one half minutes", do not include a seconds figure; represent it as "14:30,5", "T1430,5", "14:30.5", or "T1430.5".
There is no limit on the number of decimal places for the decimal fraction.
https://en.wikipedia.org/wiki/ISO_8601
I use 7 digits after the decimal point (not for precision, its a useful poor man's unique).
Davo
Totally Agree.
5.
Facts: my Language (hu/hun) is using currently this insane format of "short DateTime" by default at Win10+
'yyyy. mm. dd. hh:nn:ss,z'
(Yes, Spaces between Y/M/D ! , and comma as dec. separator. But it was "normal" at Win3.1-Win7, they changed just in the last few years. "Run in compatibility more" does not help either.)
- So 'truncating' to 23 chars is not a solution.
- forcing to write a new time-date analyst-function for ourself makes FPC useless
- Changing FormatSettings does not help at all. Tried 20 hours long all possibilities.
- also it would not help with: build-in .asDateTime function failing by default.
Summarized = finished code = Copy+Paste = ALL DONE:
if (ElemLen <= 2) or ((ElemLen <= 8) and (TimeIndex = tiMSec) ) then // Line#: 646
begin
if (TimeIndex = tiMSec) and (ElemLen > 3) then
ElemLen := 3;
Val(StrPas(S + FirstSignificantDigit, ElemLen), Value, Err); // this line is old code, no change needed
Debate closed, everyone is happy.