Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vdr] Re: [ANNOUNCE] pim plugin 0.0.5



C.Y.M wrote:
Achim Tuffentsammer wrote:

Hello all,

I'd like to announce a new version of the pim plugin.
...

Hi,

Are there poison patches posted for this release?

There are a few functions utilizing "localtime" which need to be changed to "localtime_r" in calendar.c.

--SNIP--

cCalendar::cCalendar()
{
// calculate today's date

time_t t = time(NULL);
struct tm *now = localtime(&t);

// default: display calendar for actual month

_month = now->tm_mon + 1;
_year = now->tm_year + 1900;

initData();
}

--SNIP--

Unfortunately, Im not quite sure what to do with "now" since it is setting _month and _year. All suggestions welcome. I am assuming it should look something like this:

struct tm now;
localtime_r(&t, &now);

Hi,

that should do it:

  // calculate today's date

  time_t t = time(NULL);
  struct tm *res;
  struct tm *now = localtime_r(&t, res);

  // default: display calendar for actual month

  _month = res->tm_mon + 1;
  _year  = res->tm_year + 1900;

Rg.
Achim




Home | Main Index | Thread Index