Changeset 512

Show
Ignore:
Timestamp:
04/22/07 23:06:08 (2 years ago)
Author:
goodea
Message:

notorious

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/hal/lpc2106-cmucam3/rdcf2.c

    r511 r512  
    114114  time_t now; 
    115115 
    116   gettimeofday (&temp, 0); 
    117   now = temp.tv_sec; 
    118   localtime_r (&now, &dateTime); 
    119   // time is correct. 
    120   p->hour = dateTime.tm_hour; 
    121   p->minute = dateTime.tm_min; 
    122   p->second = dateTime.tm_sec; 
    123   p->month = dateTime.tm_mon + 1; 
    124   p->day = dateTime.tm_mday; 
    125   p->year = dateTime.tm_year + 1900; 
     116  if (gettimeofday (&temp, 0) == 0) { 
     117    // time is correct 
     118    now = temp.tv_sec; 
     119    localtime_r (&now, &dateTime); 
     120 
     121    p->hour = dateTime.tm_hour; 
     122    p->minute = dateTime.tm_min; 
     123    p->second = dateTime.tm_sec; 
     124    p->month = dateTime.tm_mon + 1; 
     125    p->day = dateTime.tm_mday; 
     126    p->year = dateTime.tm_year + 1900; 
     127  } else { 
     128    // time is incorrect, apply "the notorious 1-1-80 00:00:00" 
     129    p->hour = 0; 
     130    p->minute = 0; 
     131    p->second = 0; 
     132    p->month = 1; 
     133    p->day = 1; 
     134    p->year = 1980; 
     135  } 
    126136} 
    127137