[patch] Improved date/time formatting routines
Original Reporter info from Mantis: Gorelkin
-
Reporter name: Sergei Gorelkin
Original Reporter info from Mantis: Gorelkin
- Reporter name: Sergei Gorelkin
Description:
The attached patch contains improvements to sysuitls date/time formatting routines:
- Adds threadsafe (Delphi-compatible) versions of DateToStr, TimeToStr, DateTimeToStr, FormatDateTime.
- Core functionality moved to DateTimeToString, which directly uses 'out' parameter in order to avoid unnecessary result copying.
- Modified the code so no temporary AnsiStrings are used (speed).
- Fixes a bug which would cause infinite recursion if (Short|Long)DateFormat variable would contain 'd' character or, likewise, (Short|Long)TimeFormat would contain 't'.
- Fixes numerous small Delphi compatibility issues, like: empty format string has the same effect as 'C'; overlong tokens treated as the longest possible ones (e.g. 'ddddddddd' is the same as 'dddddd'); 'AM/PM' is output preserving its case, etc.
Mantis conversion info:
- Mantis ID: 14905
- Platform: all
- Version: 2.5.1
- Fixed in revision: 14116 (#b3ea1668)
- Target version: 2.5.1