Changeset 4356 for trunk/reader-dre.c


Ignore:
Timestamp:
Jan 7, 2011, 2:01:57 AM (9 years ago)
Author:
Admin
Message:

Replace all occurences of localtime() with the threadsafe version localtime_r()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/reader-dre.c

    r4141 r4356  
    115115      end = (cta_res[7] << 24) | (cta_res[8] << 16) | (cta_res[9] << 8) | cta_res[10];
    116116
    117       struct tm *temp;
    118 
    119       temp = localtime (&start);
    120       int startyear = temp->tm_year + 1900;
    121       int startmonth = temp->tm_mon + 1;
    122       int startday = temp->tm_mday;
    123       temp = localtime (&end);
    124       int endyear = temp->tm_year + 1900;
    125       int endmonth = temp->tm_mon + 1;
    126       int endday = temp->tm_mday;
     117      struct tm temp;
     118
     119      localtime_r (&start, &temp);
     120      int startyear = temp.tm_year + 1900;
     121      int startmonth = temp.tm_mon + 1;
     122      int startday = temp.tm_mday;
     123      localtime_r (&end, &temp);
     124      int endyear = temp.tm_year + 1900;
     125      int endmonth = temp.tm_mon + 1;
     126      int endday = temp.tm_mday;
    127127      cs_ri_log (reader, "[dre-reader] active package %i valid from %04i/%02i/%02i to %04i/%02i/%02i", i, startyear, startmonth, startday,
    128128          endyear, endmonth, endday);
Note: See TracChangeset for help on using the changeset viewer.