Mailing List archive

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

[vdr] Re: [ANNOUNCE] pim plugin 0.0.5



Achim Tuffentsammer wrote:
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;

Thank you for the help. I just noticed that "now" is an unused variable in this example. Attached is a patch that seems to work and compile cleanly.

Best Regards,
diff -ru pim-0.0.5/calendar.c pim-0.0.5-poison/calendar.c
--- pim-0.0.5/calendar.c	2005-01-17 10:30:50.000000000 -0800
+++ pim-0.0.5-poison/calendar.c	2005-02-06 01:45:32.000000000 -0800
@@ -45,7 +45,7 @@
   // calculate today's date
   
   time_t t = time(NULL);
-  struct tm *now = localtime(&t);
+  struct tm *now = localtime_r(&t, now);
 
   // default: display calendar for actual month
   
@@ -74,7 +74,7 @@
   // as today :-)
   
   time_t t = time(NULL);
-  struct tm *now = localtime(&t);
+  struct tm *now = localtime_r(&t, now);
 
   _today_d = now->tm_mday;
   _today_m = now->tm_mon + 1;
@@ -121,7 +121,7 @@
 void cCalendar::reset()
 {
   time_t t = time(NULL);
-  struct tm *now = localtime(&t);
+  struct tm *now = localtime_r(&t, now);
 
   _month = now->tm_mon + 1;
   _year  = now->tm_year + 1900;

Home | Main Index | Thread Index