Possible null pointer exception

Please post support and help requests here.
Posts: 19
Joined: 16 Jun 2007, 15:30

Possible null pointer exception

Postby rd » 22 Sep 2007, 21:48


I think the Timezone::isDst() functions on Windows and Unix both have a possible bug: you should check if the localtime() function returns a NULL pointer or not.

I also find it a bit strange that the Poco::LocalDateTime() class doesn't have a constructor which calculates on the fly the tzd() of the supplied time.

At the moment I calculate it myself like this:

Code: Select all

Poco::LocalDateTime TimeLib::unixTimeToLocalDateTime(Poco::Int64 utc_unixtime)
   Poco::Timestamp ts(Poco::Timestamp::TimeVal(utc_unixtime)*Poco::Timestamp::resolution());
   // tzd() = utcOffset() + dst();
   int tzd = Poco::Timezone::utcOffset();
   if (Poco::Timezone::isDst(ts))
      tzd += 3600;   // Always 1 hour ?
   return Poco::LocalDateTime(tzd, Poco::DateTime(ts));


Return to “Support”

Who is online

Users browsing this forum: No registered users and 1 guest