#13679: Implement a Relative DateTime Formatter
-------------------------------+----------------------------
Reporter: akshay | Owner: pulkomandy
Type: task | Status: new
Priority: normal | Milestone: Unscheduled
Component: Kits/Locale Kit | Version: R1/Development
Resolution: | Keywords:
Blocked By: | Blocking:
Has a Patch: 1 | Platform: All
-------------------------------+----------------------------
Comment (by pulkomandy):
Using "experimental" APIs from ICU is fine. There may be some changes in
later versions but usually we can adjust our code when we update ICU
(which we don't do that often).
It would be nice to adjust existing code to benefit from this. WebPositive
download window and Tracker copy dialog both come to mind as cases where
we need such a thing.
Code review:
* line 100: strange indenting style, I don't think the : should be alone
on its line
* you should use new<std::nothrow> instead of new if you want to check
allocation errors by getting NULL pointers. Otherwise, new will throw an
std::bad_alloc exception when it runs out of memory, and NULL checks are
useless (but the exception should be caught). Since catching the exception
from the initialization list of a constructor is not easy, std::nothrow is
probably the best solution here. (if you copied that pattern from another
class, it should be fixed there as well).
* I find it unhandy that this class works with a time_t. Is it not
possible to use a BDateTime instead?
* Why does it need to know about the timezone? If it's working with
time_t dates, these should always be in UTC. If it's working with
BDateTime, each BDateTime object should know about its own timezone (and
DST setting if applicable), so that it is possible to compute a time delta
between dates from different timezones.
--
Ticket URL: <https://dev.haiku-os.org/ticket/13679#comment:2>
Haiku <https://dev.haiku-os.org>
The Haiku operating system.