[haiku-development] Re: Extending the BTime class

  • From: Stephan Assmus <superstippi@xxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Mon, 12 Jul 2010 20:02:28 +0200

On 2010-07-13 at 18:55:58 [+0200], Adrien Destugues 
<pulkomandy@xxxxxxxxxxxxxxxxx> wrote:
> > BDate, and BTime are currently private extensions (their header
> > actually shouldn't be in os/support). Feel free to change them as
> > needed.
> > Maybe you can work around needing to link against liblocale.so by
> > using
> > strftime()?
> > Since they are libbe.so classes, you cannot simply link against
> > liblocale.so, though.
> 
> Unfortunately, I don't need only formatting, but access to the internal
> format information, to create a control that allows the user to set
> each part of the time value individually.
> I found out that ICU 4.4 can actually do what I want more easily, so
> I'm going to just add methods to convert to time_t in BDate and BTime
> and then use them in something like BCountry::FormatTime(BString*,
> BTime).

I hope you saw that BTime and BDate cannot by themselves represent a 
time_t. That's what BDateTime is for. And that one already has the 
conversion methods for time_t support, as Christophe pointed out. So 
BContry::FormatTime() should either take BDateTime, or there should be 
three overloaded versions for BTime, BDate and BDateTime each.

Best regards,
-Stephan

Other related posts: